vaheqelyan / svelte-grid

A responsive, draggable and resizable grid layout, for Svelte.
https://svelte-grid.now.sh/
MIT License
948 stars 57 forks source link

Simple fix to make items not jump if Grid is resized. #133

Closed WbaN314 closed 1 year ago

WbaN314 commented 1 year ago

Quick and dirty fix for the jumping items on Grid resize problem #125.

If moveAnimation = true nothing changes. If moveAnimation = false the items will not play a move animation and jump directly to the desired spots. This fixes the item jumps when the Grid component itself changes size.

This also affects regular movement of components as they will now also jump to their desired spots instead of transitioning. This could be improved by combining the moveAnimation flag with on:resize listener in a more sophisticated approach.

WbaN314 commented 1 year ago

Fix suggested in https://github.com/vaheqelyan/svelte-grid/issues/125.