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

[Bug]: discardActiveObject called from object:modified handler causes loop [nuxtjs] #10170

Open
7 tasks done
matiszac opened this issue Sep 21, 2024 · 1 comment
Open
7 tasks done
Assignees
Labels

Comments

@matiszac
Copy link

CheckList

  • I agree to follow this project's Code of Conduct
  • I have read and followed the Contributing Guide
  • I have read and followed the Issue Tracker Guide
  • I have searched and referenced existing issues and discussions
  • I am filing a BUG report.
  • I have managed to reproduce the bug after upgrading to the latest version
  • I have created an accurate and minimal reproduction

Version

6.0.2

In What environments are you experiencing the problem?

Firefox

Node Version (if applicable)

None

Link To Reproduction

https://stackblitz.com/edit/nuxt-starter-638zzj?file=app.vue

Steps To Reproduce

  1. create canvas
  2. create event handler that calls canvas.discardActiveObject()
  3. attach handler to canvas.on('object:modified', handler)
  4. create any object, like a rect and add it to the canvas.
  5. select the object and move it, when releasing the mouse it will trigger object:modified and call the handler

Expected Behavior

I expect that it wont trigger object modifed because when calling discardActiveObject from a button lets say, it does not trigger the object modifed event.

Actual Behavior

it will discard and modify in a loop

Error Message & Stack Trace

too many recursions
@asturur
Copy link
Member

asturur commented Sep 26, 2024

Discarding an object that is currently trasforming will terminate its transform action.
If what you want is to deselect on object:modified i would suggest you get target.canvas._currentTransform and you set it to null before deselecting.

I think the code should be fixed to avoid this infinite loop anyway.

@asturur asturur added the bug label Sep 26, 2024
@asturur asturur self-assigned this Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants