-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
fix(Canvas): safeguard canvas add #7866
Conversation
removes objet from previous canvas when adding to a new one
Code Coverage Summary
|
Code Coverage Summary
|
Code Coverage Summary
|
'Resulting to default behavior: removing object from previous canvas and adding to new canvas'); | ||
/* _DEV_MODE_END_ */ | ||
obj.canvas.remove(obj); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is totally fair, because the old reference in the canas would be just a broken reference.
i used this a couple of times to render objects in different canvases for copy purposes, the thing i was doing was to swap the canvas reference manually, while now i should go through the add/remove process and avoid extra renders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to check for duplicates as well? I think it's damaging for perf and I don't see too much advantage for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we do we can do in the dev mode braket and remove it in prod build.
This exposed a regression for toCanvasElement. |
#7866 exposed a regression when using `toCanvasElement` This commit fixes it and fixes another issue: `object.toCanvasElement()` would fire an added event which is absolutely undesired
removes object from previous canvas when adding to a new one