dsmorse / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://dsmorse.github.io/gridster.js/
MIT License
795 stars 194 forks source link

Reordering stucks in some situations #44

Open KristofMorva opened 8 years ago

KristofMorva commented 8 years ago

I don't know if these problems have any connection, so I only open one ticket. The problem is, in some situations we can't drag&drop like we could have some versions before. For example this item just cannot be moved one column to the left: Example Sometimes bigger items are not moving smaller items away while dragging, making it impossible to drop, and in rare situations you can place items above each other. Lastly, if you drag one item, you can keep pushing another item out in nowhere without limits. All of these can be reproduced easily on the main page of the official GitHub website (http://dsmorse.github.io/gridster.js/)

heartdisease commented 8 years ago

Same here! I can't upgrade to the latest version because it completely breaks the drag/collision handling on my dashboards.

heartdisease commented 8 years ago

Seems like I've found the piece of code that causes this issue. The bug got introduced with bug fix #43 from @mmontero that got merged a few days ago.

There must be something wrong with the calculation of the y-units (cellsToMove) in method on_stop_drag:

// get number of cells to move var destinyRow = this.placeholder_grid_data.row + this.placeholder_grid_data.size_y; var currentOverlappedRow = parseInt(this.gridmap[tcol][trow][0].getAttribute('data-row')); var cellsToMove = destinyRow - currentOverlappedRow; this.move_widget_down(this.is_widget(tcol, trow), cellsToMove);

If I replace cellsToMove with this.placeholder_grid_data.size_y everything works again as it did before the change. Unfortunately I don't really understand what is being done here so it'd be great if the user who made the original pull request could fix this.

parliament718 commented 8 years ago

I'm also experiencing this issue. Drag is completely unusable in my app after switching to this dsmorse fork for responsiveness. I applied the fix above, but dragging is still slow, buggy, and unusable.

marctc commented 7 years ago

Same here! In the version 0.6.9 it works properly.