-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using drag and drop to create nested Grids #1009
Comments
related to #992 |
maybe a ctrl/alt key could signal wanting to drop over vs moving item out of the way. Would be cool feature.... |
Hi @adumesny, now that we have a sub grid accepting an item from its parent grid, I want to create a sub grid by dragging an item from a parent grid and hovering it on top of another item, then dropping it on top it. Regarding the method to distinguish between an item just pushing another one and creating a sub grid (folder)... would perfectly overlapping an item on top of another one work? Dragging item will push an item when it overlaps less 90% for example, but if the dragging item is hovered on the other one like a solar eclipse and kept it for like a few seconds, then it creates a sub grid containing the other item. It's basically how iphone home operates (refer to the youtube video below). I am open to and eager to keep things simpler for the sake of clean UI and code, but I cannot afford to demand users to press an extra key for an UI to do this feature or determine how items to react to user's interaction. https://youtu.be/lS4TtjOTmR0?t=33 sr_7o2LMf2G.mp4Thanks! |
The iphone desktop is clearly a great design, but is solving a different and limited problem
One crazy idea would be to have an 'iphone desktop' mode that would replicate the above as much as possible, but that would be a big task...not sure how deep your pocket is. |
Would this simplify this issue?: only when colliding item's size matches the target item's to activate nesting option. Or even 1x1 to 1x1 case to be the only nesting case is okay.
I need to put items with diverse sizes into an already created sub-grid but don't need to do the new collide-to-nest feature when 2x1 to 1x1 something like that. Maybe the sub-grid created by this new feature to have a size of 2x2 by default or any size that fits the inserted two items which are the dragging and the collided one.
I think when a dragging item is placed on the exact top of another item covering it can tell the difference. When drag is stopped on top of an item but doesn't overlap quite fully, then it should just push it.
I think sub-grid CSS should be up to library users, and the CSS should be applied to the sub-grid such as its background or border, not to the items in it. I am also no to the sub-grid staying 1x1 and opening up a modal, I didn't intend to mimic this. I'm satisfied with how GS shows a sub-grid showing its containing items explicitly.
I want to keep the size of an item in a sub-grid to be very similar or exactly the same as an item on the top-level grid. So change a sub-grid's column using .column() whenever the sub-grid gets resized.
Can this be resolved by my answer on Q1? |
| I think when a dragging item is placed on the exact top of another item covering it can tell the difference. When drag is stopped on top of an item but doesn't overlap quite fully, then it should just push it. only problem is you already have pushed before you completely overlap UNLESS you need to pause to push (which is not ideal since pushing is likely a lot more common that create new nesting) OR have a very specific area to push that is small enough that if you pass it (on the way to overlap) you can restore it back so you can later overlap and nest... Likely much harder to do with randomly shaped items of different sizes than phone 1x1 squares... I need to think more about this and how that would affect everyone vs 4.x we have today.... | I want to keep the size of an item in a sub-grid to be very similar or exactly the same as an item on the top-level grid. So change a sub-grid's column using .column() whenever the sub-grid gets resized. we're on the same page here and something that can be done now. I thought about it after I updated the nested.html example and thought about how we could keep all the children the same size... |
How about we provide an option to enable this collide-to-nest feature, then a little pause to push is acceptable for those who want this feature. I believe dragging an item onto the in-between space is intuitive and won't be a bad UI when the nesting option is enabled. |
What is required to finalize #1941 ? As far as I understand, having groups A and B (the same nesting level), dragging B to A can only be implemented by enabling a certain mode (via ctrl/alt). How much is it possible and labor-intensive? I'm ready to do it, please tell me where to start? |
starting work on this as Stephane P has generously sponsored this feature... |
* partial fix for gridstack#1009 * Create sub-grids on the fly, by dragging items completely over others (nest) vs partially (push) using new flag `GridStackOptions.subGrid.createDynamic=true`. * ability to pause drag&drop collision until the user stops moving - see `DDDragOpt.pause` TODO: need to make it work on already nested grids, remove nested on drag out, more testing...
* partial fix for gridstack#1009 * Create sub-grids on the fly, by dragging items completely over others (nest) vs partially (push) using new flag `GridStackOptions.subGrid.createDynamic=true`. * ability to pause drag&drop collision until the user stops moving - see `DDDragOpt.pause` TODO: need to make it work on already nested grids, remove nested on drag out, more testing...
first part done! using pause to differentiate between push and nesting... lot of work, more to do. 20220924_160517.mp4 |
* more partial fix for gridstack#1009 and gridstack#992 * you can now drag a nested grid over another one and nest it deeper (992) * fixed size transition * fixed handlers not set when nesting TODO: fix pause to work for enter/leave, more nested testing. Fix tests
you can now drag sub-grids into sub-grids, creating unlimited nesting 20220925_085403.mp4 |
fix gridstack#1009 remaining issues * dragging out last item will nuke empty nested grid * dragging over item to create nested grid, will revert back to normal item if you continue to drag out * fixed CSS issues dragging nested in/out couple times
fix gridstack#1009 remaining issues * dragging out last item will nuke empty nested grid * dragging over item to create nested grid, will revert back to normal item if you continue to drag out * fixed CSS issues dragging nested in/out couple times TODO: fix test cases, doc, more testing
more edges fixes - make sure to delete temporary nested grids or empty ones 20220925_195559.mp4 |
more for gridstack#1009 * fixed makeSubGrid() to migrate node content field as well (not just html dom) * save() now removes w,h of 1 * fixed dragging sub-grid over another, dragging content out not deleting empty sub-grid * fixed test cases
Hello, |
@vszakd not without having a disctinc behavior of push vs merge into subgrid - see #1009 (comment) |
Nest items within items with drag and drop.
How can I nest items within items using drag and drop.
Your environment
Steps to reproduce
I need to drag menu items (grid-stack-item-content) into item (grid-stack-item-content), nesting parent and child items. The example is in:
https://github.com/AlessandroNogueiraPorto/gridstack
Expected behaviour
Group child items within parent items using drag and drop.
Actual behaviour
Items are currently draggable but not grouped within another item.
I need to build a process diagram with gridstack by including items within other items.
The text was updated successfully, but these errors were encountered: