question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Item follows mouse pointer and gridster crashes

See original GitHub issue

Hi, in my application I have implemented the gridster. The issue is that after some time dragging arround an item it is binded to the mouse pointer. I have created a gif which Shows the behaviour: bug As you can see on every mouse drag Event I am previously getting an

‘Unable to preventDefault inside passive event listener invocation.’

in gridsterDraggable.sevice.js in line 49 ,80 and 101. After some time the gridster then crashes at all. With the Errors: 1.

Unaught TypeError: Cannot read property ‘x’ of undefined at GridsterDraggable.calculateItemPosition (gridsterDraggable.service.js:173) at GridsterDraggable.calculateItemPositionFromMousePosition (gridsterDraggable.service.js:91) at GridsterDraggable.dragMove (gridsterDraggable.service.js:85) at HTMLDocument.eval (platform-browser.js:2628) at HTMLDocument.globalListener

and

Uncaught (in promise): TypeError: Cannot read property ‘setPushedItems’ of undefined TypeError: Cannot read property ‘setPushedItems’ of undefined at GridsterDraggable.makeDrag (gridsterDraggable.service.js:147) at ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:4760) at ZoneDelegate.invoke (zone.js:387) at Zone.run (zone.js:138) at eval (zone.js:872) at ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4751) at ZoneDelegate.invokeTask (zone.js:420) at Zone.runTask (zone.js:188) at GridsterDraggable.makeDrag (gridsterDraggable.service.js:147) at ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:4760) at ZoneDelegate.invoke (zone.js:387) at Zone.run (zone.js:138) at eval (zone.js:872) at ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4751) at ZoneDelegate.invokeTask (zone.js:420) at Zone.runTask (zone.js:188) at resolvePromise (zone.js:814) at eval (zone.js:877) at ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4751) at ZoneDelegate.invokeTask (zone.js:420) at Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:595) at ZoneTask.invokeTask [as invoke] (zone.js:500) at invokeTask (zone.js:1540) at HTMLDocument.globalZoneAwareCallback (zone.js:1566)

For the gridster Options I have the following:

this.options = {
          gridType: GridType.Fit,
          itemChangeCallback: DisplayWidgetsComponent.itemChange,
          itemResizeCallback: DisplayWidgetsComponent.itemResize,

          compactType: CompactType.None,
          margin: 1,
          outerMargin: false,
          minCols: 80,
          maxCols: 130,
          minRows: 50,
          maxRows: 100,
          displayGrid: 'always',
          draggable: {
            delayStart: 0,
            enabled: true,
            ignoreContentClass: 'gridster-item-content',
            ignoreContent: false,
            dragHandleClass: 'drag-handler',
            stop: function ($event) {
            }
          },
          resizable: {
            enabled: true
          }
        };

and my HTML Looks like this:

<gridster [options]="options" class="widget-container">
        <gridster-item  *ngFor="let widget of widgets" [item]="widget.position" class="drag-handler" style="background: green">
          <div class="gridster-item-content">Hello</div>
        </gridster-item>
</gridster>

I am using Angular Version 5.2.11 gridster Version 5.3.3 I even tried to use the Options whih are defined on he example site from gridster but that made no difference. Always the same issue. Does anybody knows where the issue is coming from and how to solve or prevent it? Thanks in advance.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
kunal105commented, Aug 31, 2018

Thanks. I have this working now without issues. Should apply to iframes as well. Below is what I ended up doing. i set pointer-events to none in both resize and change callback and then set to initial on mouseup event of gridster-item.

itemChange(item: GridsterItem, itemComponent: GridsterItemComponentInterface) {
var el = document.getElementById(item.inputs.widgetId); // el.style.pointerEvents = ‘none’; }

itemResize(item: GridsterItem, itemComponent: GridsterItemComponentInterface) { var el = document.getElementById(item.inputs.widgetId); el.style.pointerEvents = ‘none’; }

enablePointer(widgteId: string) { var el = document.getElementById(widgteId); el.style.pointerEvents = ‘initial’; }

<gridster-item [item]=“item” *ngFor=“let item of gridsterItemArray” (mouseup)=“enablePointer(item.inputs.widgetId)”>

1reaction
kunal105commented, Aug 26, 2018

yeah same here. the issue does not seem to be fixed.

To reproduce Please go here https://portal.tradingwidgets.com/ Open Chrome Developer tools. This happens more when developer tools is open. Move around the widget “technical analysis” on bottom right corner of dashboard. The issue is random but you should be able to reproduce if you move around some of the graphical widgets on this dashboard. you can use the hand tool to do that.

This happens more when there are many widgets and you are trying to move a widget over other widgets and then mouse gets stuck with the widget and only way out is to refresh page. You cannot even put it back in the same place as before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to fix overlapping of angular-gridster items while shrinking
The grid looks fine in desktop screen when it is resized down or in full screen the grid overlaps and elements below each...
Read more >
react-grid-layout | Yarn - Package Manager
React-Grid-Layout is a grid layout system much like Packery or Gridster, for React. Unlike those systems, it is responsive and supports breakpoints.
Read more >
VMware Carbon Black EDR User Guide
enables communication between a third-party product and a Carbon Black EDR ... Or, place your cursor inside the area that is defined by...
Read more >
Gaia Data Release 1: The archive visualisation service - arXiv
The first Gaia data release (DR1) delivered a catalogue of astrometry and photometry for over a billion astronomical sources. Within.
Read more >
4.2.0 :: Hue Documentation - GitHub Pages
The release comes with a Customer 360 demo showcasing the Editor to query credit card transaction data that is saved in an object...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found