ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.03k stars 1.2k forks source link

Widget right edge collision detection #408

Open adamyonk opened 10 years ago

adamyonk commented 10 years ago

I'm seeing this issue when I try to drag a widget all the way to the right side of the grid. Everything looks fine till the widget touches the rightmost edge of the grid, then the placeholder snaps back to the left one column and if you release the widget, that's where it goes. Any ideas as to why this might be happening?

side

adamyonk commented 10 years ago

Having a terrible time debugging this. I think it originates somewhere in the find_collisions() function, but I'm not quite sure, yet. Any guidance in where to look for this would be appreciated.

adamyonk commented 10 years ago

For whatever reason, wrapping these lines in an if (area != 0) solves this issue for me. Still not sure what else that will effect.

jhowley89 commented 10 years ago

This solved some problems for me where on a fixed 2 column layout any widget which was dragged to touch/overlap the right-hand border failed to correctly place after drop. @adamyonk maybe you should put a merge request in. also possibly helps people with overlapping as this was the end result for me prior to adding this fix

Lukesed commented 10 years ago

I encountered this issue when widget_margins was set to [0, 0]. Changing to [.001, 0] stopped the behavior without affecting the appearance of the grid. If you don't like to modify your dependencies, there's a workaround.