Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to limit the boundary when changing the size #68

Open
iuenieZachary opened this issue Sep 4, 2024 · 5 comments
Open

How to limit the boundary when changing the size #68

iuenieZachary opened this issue Sep 4, 2024 · 5 comments

Comments

@iuenieZachary
Copy link

I have looked at the demo and readme documentation and found no parameters that can configure the boundary limit, but after looking at the source code, it seems that I have seen the relevant boundary limit, but do not know how to configure it

@Fuzzyma
Copy link
Member

Fuzzyma commented Sep 4, 2024

Where did you see the relevant code? Can you link it? Because I cant find it

@iuenieZachary
Copy link
Author

I saw that the box in the movePoint function in the Resizehandler.js file uses the maxBoxFromPoints method, maybe I misunderstood. My main question is what parameter or method is being used to replace the constraint parameter after it is removed

@iuenieZachary
Copy link
Author

In version 2.0.1, how do I need to achieve the same effect as constraint parameters

@Fuzzyma
Copy link
Member

Fuzzyma commented Sep 4, 2024

None, it was removed.
You can realize the same behavior by listening to the resize event and call event.preventDefault() if the new dimensions are not to your liking:

rect.on('resize', (event) => {
  console.log(event.detail.box)

  if (event.detail.box.width > 300) event.preventDefault()
})

@iuenieZachary
Copy link
Author

Ok, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants