jbaysolutions / vue-grid-layout

A draggable and resizable grid layout, for Vue.js.
https://jbaysolutions.github.io/vue-grid-layout/
MIT License
7.12k stars 1.51k forks source link

Aspect ratio is not always kept because of snapping to grid. #555

Open MadalinaCi opened 3 years ago

MadalinaCi commented 3 years ago

After setting the preserveAspectRatio option to true, I observed that not all the elements actually keep the aspect ratio. For ratio = 1, everything seems to be fine, but for other aspect ratios, it doesn't seem to work because of the snapping back to grid.

When I'm resizing the element, I can see that it has the correct aspect ratio, but when dropping it, because it takes the closest place in the grid, it doesn't always takes into account the aspect ratio.

I found a fix to ensure that the aspect ratio is preserved if the preserveAspectRatio option is true and I will add a PR asap.

validide commented 3 years ago

@gmsa is this something you plan support in the library?