angular2-grid icon indicating copy to clipboard operation
angular2-grid copied to clipboard

programatic resizing of grid item causes collision detection to reorder items

Open lkirby1266 opened this issue 8 years ago • 3 comments

https://plnkr.co/edit/ou5UhYLKJUQ8d5M0ju27?p=info

If you resize an item such that it causes multiple collisions, the order of the widgets returned by the collision detection keeps reversing. In the example plunk, if you click makeBig on item 1, then items 2,3,4 get reordered as 4,3,2.

Suggest revising _getCollisions() to return returns.reverse() instead of returns

lkirby1266 avatar Jun 30 '17 15:06 lkirby1266

Also, in the same plunk, if you just drag item 1 to the right a little, and release, it will reorder 2,3,1,4 even though there should not have been any collisions detected.

lkirby1266 avatar Jun 30 '17 16:06 lkirby1266

We are also experiencing this and its preventing us to do a release atm. I will have a look if I can find the reason, but I can already say that returns.reverse() wont fix the issue. It works if there is only 1 column, but already with 2 columns it won't help and it almost seems like the items are getting randomly moved. In our application it works for some reason if I change the getCollisions to always return empty array. So there is definitely something wrong.

sconix avatar Dec 03 '17 14:12 sconix

Actually our problem was different. The fault in our case was accidental resetting of the grid settings :).

sconix avatar Dec 03 '17 15:12 sconix