Jump to content


setScaleConstraints problem [SOLVED]

Recommended Posts

Hi there,


I'm trying to use TransformManager classes to make an image scalable within it's scale constraints (which is what TransformItem's setScaleConstraints method is for)

but also it needs to be able to flip using a flip button (which calls something like _transformManager.flipSelectionHorizontal() when pressed).


The problem these two levels of functionality appear to be incompatible :shock: .. as the flipSlectionHorizontal won't work since the scale constraints I need to have are positive numbers (minScaleX: 0.5, maxScaleX: 2,, and the same for scaleY)...


I have attached a demo that shows the incompatibility, and am trying to hack it to make it work how I'd like, but can't find a way.


I'd be really grateful to anyone that can help!

Link to comment
Share on other sites

  • 2 weeks later...

Since flipping requires a negative scaleX and/or scaleY value, you'd need to set the minimum to be negative (your example used positive minimums).


(we communicated via e-mail and resolved the issue)

Link to comment
Share on other sites

  • 2 years later...

The minScale value in my case should be 0.3. However, when I set it to -0.3, flipping does still not work as expected (the object rather gets squashed) and the user (using the handles) is able to scale the object to a smaller size than I want him to be able to.


I guess the original poster was right to a certain degree in saying that scaling restraints and flipping are two functions that don't work together well, or am I missing something?

Link to comment
Share on other sites

Help me understand: are you saying that if you set minScale to -0.3, it incorrectly allows the scale to go BEYOND -0.3 (like to -0.5)?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.