haltu / muuri

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

Incompatible with zoom #564

Open DougsSc opened 6 months ago

DougsSc commented 6 months ago

Zooming the grid breaks the calculations performed by the layout when the layout has a fixed size.

DougsSc commented 6 months ago

I fix this changing the decimal precision of PackerProcessor.roundNumber to zero, simply using Math.round and off course, enabling rounding=true on layout properties.

I haven't found any other problems with this trick, but it is possible to develop other better solutions, such as passing a function to set rounding or setting a value for decimal precision in the rounding property.