Inertia sometimes goes backwards when applying restrictEdges modifier inside aspectRatio modifier
WinslowJosiah opened this issue · comments
While trying to figure out a workaround for #805, I came across a strange issue with inertia while trying to combine aspectRatio
and restrictEdges
. This only seems to occur if the restrictEdges
modifier is applied inside the aspectRatio
modifier; if the two are separately applied in any order, one will sometimes fail to be respected (as the docs warn), but this issue with inertia does not occur.
Minimal JSFiddle: https://jsfiddle.net/t2nore5h/2/
Expected behavior
While resizing the blue div, if the mouse button is released while the cursor is accelerating in any direction, the div should continue to be resized in that same direction for a bit.
Actual behavior
When resizing the blue div, the direction of resizing shifts backwards while inertia is being applied. This happens when resizing the div either horizontally or diagonally; in testing, I was only able to get this to happen when resizing vertically with a very high acceleration.
This is easiest to notice if the div at its minimum size, and it is attempted to be resized smaller with inertia; the div should not change size, but it will in fact get bigger!
System configuration
interact.js version: 1.10.17
Browser name and version: Chrome Version 110.0.5481.105 (Official Build) (64-bit)
Operating System: Windows 11