collision overall - support for swap#1621
Conversation
big overall of the collision dectection code - you can now: * swap items of same size vertically/horizontally when grid is full (maxRow) ***** this has been 5.5years in the making and the most asked question **** It is now also the default in float:false as it feels more natural than pushing new row (could add Alt-key to get either behavior of push vs swap ?) * moving items down or up behave the same way (used to have to push WAY past to insert after) * optimized the collision code to not do extra work multiple times and only check if change and not tried before * heuristics now checks for >50% past the grid mid point (taking margin into account)a TODO part II: handle mid point of dragged over items rather 50% of row/column and check for the most covered when multiple items collide. * fix gridstack#149 gridstack#1605 and partial gridstack#1094 (need better support for larger items mid point)
|
default 20210215_102443.mp4
20210215_103145.mp4
20210215_103416.mp4 |
more fix for gridstack#1094 (part II of gridstack#1621) * we now check for >50% coverage (using pixel drag vs target region) before we collide during a drag to replace * this means we now support larger size swapping at their mid point. target is always used for mid point. Note: web demo (gridstack#1094) is still not totally ideal as item 9 goes side way for some reason...
|
Is there a workaround for the float true case? I do not have a max rows and would like to drag row 3 to 4 and have them swap. Instead, 4 is pushed down and an empty space is left where 3 was. |
|
@harrington101 that is not the design, so no 'workaround'. if you don't want empty spaces, that is what |
|
I'm not looking for a hybrid. Instead, I'm looking to have box 1 swap with box 2 rather than running away from it. I do want empty spaces which is why I set float to true. The issue is that box 2 moves unexpectedly. |
Description
big overall of the collision detection code - you can now:
maxRow)this has been 5.5years in the making and the most asked question
It is now also the default in
float:falseas it feels more natural than pushing new row(could add Alt-key to get either behavior of push vs swap ?)
if change and not tried before
TODO part II: handle mid point of dragged over items rather 50% of row/column
and check for the most covered when multiple items collide.
Checklist
yarn test)