You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've noticed strange behavior when trying to rotate object that has lockRotation set to true. At first it performs object:rotating event on object even that it's not rotating. And what is even more unwanted when rotation is finished it fires object:modified but nothing has changed. When I investigated what properties has changed using this code:
it appeared to be left, top, originX, originY properties. I understand that it's because of changing origin point to center, center while rotating. But origin change shouldn't happen at all because rotation had been locked. When I set lockRotation to false it's detecting change of angle property and those four previously mentioned. But it should only show angle. My conclusion is that it shouldn't detect properties change if those properties were modified only as a side effect of transformation. Probably the same situation has place if it goes about scaling.
// From console
hasStateChanged(top) fabric.js:12846
current: 196.06459398155516 fabric.js:12847
original: 71.06459398155516 fabric.js:12848
hasStateChanged(left) fabric.js:12846
current: 627.9755859375 fabric.js:12847
original: 559.55517578125 fabric.js:12848
hasStateChanged(originX) fabric.js:12846
current: center fabric.js:12847
original: left fabric.js:12848
hasStateChanged(originY) fabric.js:12846
current: center fabric.js:12847
original: top
Problem can be solved by moving the line this._restoreOriginXY(target); before the target.hasStateChanged() function. But this change will probably cause another error - lack of change detection of originX and originY. But is it a problem?
Actually fabric.Canvas.prototype._finalizeCurrentTransform function is only executed on mouseup event. Is there any chance that origin will change permanently (without going to previous state) during object transformation?
fabric.Canvas.prototype._finalizeCurrentTransform: function(){vartransform=this._currentTransform,target=transform.target;if(target._scaling){target._scaling=false;}target.setCoords();this._restoreOriginXY(target);// THIS LINE WAS MOVED HERE FROM... ~~~~~~~~// only fire :modified event if target coordinates were changed during mousedown-mouseupif(this.stateful&&target.hasStateChanged()){this.fire('object:modified',{target: target});target.fire('modified');}// ... THIS POSITION ~~~~~~~~};
Hi, I've noticed strange behavior when trying to rotate object that has
lockRotation
set totrue
. At first it performsobject:rotating
event on object even that it's not rotating. And what is even more unwanted when rotation is finished it firesobject:modified
but nothing has changed. When I investigated what properties has changed using this code:it appeared to be left, top, originX, originY properties. I understand that it's because of changing origin point to
center
,center
while rotating. But origin change shouldn't happen at all because rotation had been locked. When I setlockRotation
tofalse
it's detecting change ofangle
property and those four previously mentioned. But it should only showangle
. My conclusion is that it shouldn't detect properties change if those properties were modified only as a side effect of transformation. Probably the same situation has place if it goes about scaling.Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: