daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
9.8k stars 605 forks source link

Snap settings with `keepRatio` set to `false` are not honored #990

Open davidalejandroaguilar opened 11 months ago

davidalejandroaguilar commented 11 months ago

Environments

Framework name: StimulusJS Framework version: 3.2.1 Moveable Component version: 0.51.1 Selecto Component version: 1.26.0 Testable Address(optional): https://codepen.io/davidalejandroaguilar/pen/VwVNxWz

Description

When resizing selected elements with snap settings (snapGridWidth, snapGridHeight, snapThreshold, snapRotationThreshold, snapRotationDegrees) and keepRatio set to false, the elements no longer respect snap settings (50px snapping in the example Codepen).

In the video below, you can see how each individual element can only be resized in 50px increments, however, when both are resized at the same time, they are no longer snapping correctly, and they end up outside the grid.

https://github.com/daybrush/moveable/assets/15317732/4299c49a-e0b6-4ffc-8798-6a0225f6ca74

davidalejandroaguilar commented 9 months ago

@daybrush Just bringing this into your attention, seems like it's a bug?

EDIT: Oops, sorry, just noticed you were on vacation, my bad and hope you enjoyed them! 🏖️

daybrush commented 9 months ago

@davidalejandroaguilar

sorry. I couldn't care much.

your expected behavior

If keepRatio (false) and snapGridWidth and snapGridHeight are set, you want snapGrid to work individually, not on a group basis, right?

davidalejandroaguilar commented 9 months ago

@daybrush I think so, yes.

Each individual element must stay within the grid, even when resizing as a group.

daybrush commented 8 months ago

@davidalejandroaguilar

moveable's new version is released. snapGridAll prop is added. Use snapGridAll prop to true.