-
-
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): selection + setViewportTransform
edge case
#7713
base: master
Are you sure you want to change the base?
Conversation
Code Coverage Summary
|
Code Coverage Summary
|
I m not sure what is going on, the explanations are scarce. |
Take a look at the demo. |
|
Code Coverage Summary
|
Code Coverage Summary
|
ready |
This is a repro http://jsfiddle.net/exabpkto/ |
Code Coverage Summary
|
dc335c1
to
5e3226b
Compare
This reverts commit 5e3226b.
Code Coverage Summary
|
Code Coverage Summary
|
Code Coverage Summary
|
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. |
Code Coverage Summary
|
Code Coverage Summary
|
Code Coverage Summary
|
Code Coverage Summary
|
Code Coverage Summary
|
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.
Fixed the main issue and found and fixed a side effect that was causing tests to fail (stale _currentTransform
ref on canvas)
@@ -1244,6 +1248,7 @@ | |||
return false; | |||
} | |||
this._activeObject = null; | |||
this._currentTransform = null; |
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.
crucial cleanup in case active object is during a transform
} | ||
fabric.StaticCanvas.prototype.setViewportTransform.call(this, vpt); | ||
this._setViewportTransform(vpt); | ||
activeObject && activeObject.setCoords(); |
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 the following is sufficient because StaticCanvas sets coords on all objects
activeObject && activeObject.setCoords(); | |
activeObject && activeObject.type === 'activeSelection' && activeObject.setCoords(); |
Updated description |
Code Coverage Summary
|
This PR handle the following edge case:
Say an object is being actively transformed by the user and at some point a call to
setViewportTransform
changes canvas vpt.What happens prior to this PR is that the object jumps from the mouse because of the new vpt and then jumps back once the next event fires.
This is bad.
I think that
setViewportTransform
should not affect an active object that is being transformed.It makes no sense.
https://gkpiim.csb.app/
Repro
http://jsfiddle.net/4zexwjo6/
To fix the fiddle change the cdn.
Before
Expected Behavior
selected object should not be transformed by canvas vpt
After