interact.js icon indicating copy to clipboard operation
interact.js copied to clipboard

Aspect Ratio Modifier With Child Modifier Incorrectly Resizes Top-Right and Bottom-Left

Open tom-grove opened this issue 4 years ago • 5 comments

Resizing using the top-right and bottom-left corner breaks under certain circumstances. If I use an aspectRatio modifier on my resizable element, everything seems to work well. However, when I place that element inside of a container and add a restrict modifier to the aspectRatio modifier, the top-right and bottom-left resizing is incorrect. It seems like the X axis is incorrectly inverted in this scenario.

I have created a very small fiddle that recreates the problem well. Go to it and simply try to resize the small green rectangle from the top-right or bottom-left corner. The resizing bug will be apparent, but resizing from the top-left or bottom-right works well.

https://jsfiddle.net/voidmain26/3gojLa17/

tom-grove avatar Mar 25 '20 16:03 tom-grove

I am having a really hard time getting an environment setup to compile interact on my machine, in order to create a pull request. So, I will do my best to show what has worked for me here.

I have been able to edit aspectRatio.ts and get results I would expect now. I have done some basic tests and everything looks good to me, but I'm not sure if it has any other ramifications. I am attaching my aspetRatio.ts file.

This also seems to fix issue #805. aspectRatio.ts.zip

tom-grove avatar Mar 26 '20 18:03 tom-grove

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 09 '20 18:04 stale[bot]

I'm experiencing this issue, too. Would be great to get @voidmain26's fix incorporated into an upcoming release of the library.

bandrews avatar Aug 04 '20 20:08 bandrews

Having the same issue. I tried both previously mentioned approaches:

  • @bandrews commit changes - sometimes results in the element expanding to the bottom
  • @voidmain26 fix - breaks resizing using any top or left handles

Also, modifiers inside aspectRatio generally seem to break resizing, not just top-right and bottom left, in a sense that they don't sometimes allow you to decrease the dimensions after a certain point, so you need to re-click the handle to keep resizing. This doesn't happen when increasing dimensions.

Seems like the library went forward since the aforementioned fixes were viable... @taye any estimates or suggestions for fixing?

dbettini avatar Dec 08 '20 01:12 dbettini

I'm experiencing it too. Are there any updates on this issue?

kmathmann avatar Sep 24 '21 14:09 kmathmann