haltu / muuri

Infinite responsive, sortable, filterable and draggable layouts
https://muuri.dev
MIT License
10.75k stars 644 forks source link

Free positioning of items in grid #453

Open klehmann opened 3 years ago

klehmann commented 3 years ago

Hi Niklas! Your project looks really cool! We are searching for a grid solution where users can position the items wherever they want in the grid, e.g. some items top left, others bottom right etc.

So no autolayout requirement in that mode, just D&D to a free space with snap to nearest grid position.

Do you think this can be built? Is that possible out of the box or do we need a custom layout?

To make this work, we would need to get the drop x/y position so that we can compute the nearest grid position.

niklasramo commented 3 years ago

Yes, it can be built with Muuri, but you will need to create a custom layout algorithm and probably custom drag sort predicate.

voyti commented 2 years ago

Hey, is there any documentation on how to proceed with this (I've seen some custom layout implementations, but nothing close or touching a custom drag sort predicate)? I'm looking into staying with Muuri in our project, but this requirement seems to be a bit complicated to start with without some more detailed documentation

stefanocurnis commented 2 years ago

Hi Niklas! Your project looks really cool! We are searching for a grid solution where users can position the items wherever they want in the grid, e.g. some items top left, others bottom right etc.

So no autolayout requirement in that mode, just D&D to a free space with snap to nearest grid position.

Do you think this can be built? Is that possible out of the box or do we need a custom layout?

To make this work, we would need to get the drop x/y position so that we can compute the nearest grid position.

this is interesting. did you solve this? I'm about to write custom stuff to achieve this

klehmann commented 2 years ago

No, not yet. There are examples of http://gridstackjs.com that have this kind of layout. So I will probably go that route if that requirement come up again in the future.