fabricjs/fabric.js
qrDecompose.angle does not match obj.angle with flipX applied
開放
#5,079 建立於 2018年6月29日
help wanted
倉庫指標
- 星標
- (31,407 顆星)
- PR 合併指標
- (PR 指標待抓取)
描述
Version
2.3.3
Test Case
Go to http://fabricjs.com/matrix-transformation and run this script in console:
var obj = __canvas.item(0);
function testObject() {
var transformValues = fabric.util.qrDecompose(obj.calcTransformMatrix());
var match = obj.angle === transformValues.angle;
console.log(match ? 'yes' : 'NO', obj.angle, transformValues);
}
testObject(); // obj.angle and matrix.angle match
obj.flipX = true;
__canvas.requestRenderAll();
setTimeout(testObject, 100); // obj.angle correctly zero. matrix.angle is now 180
Steps to reproduce
Run the script above or:
- add an object to canvas. obj.angle will be zero. calcTransformMatrix + qrDecompose angle will be zero
- obj.flipX = true; requestRenderAll()
- obj.angle remains zero. qrDecompose now returns 180
Expected Behavior
fabric.util.qrDecompose(obj.calcTransformMatrix()).angle and obj.angle should both equal zero, or qrDecompose shouldn't return an angle property if it can't return an accurate value.
Actual Behavior
After the flip is applied, the result from qrDecompose is 180.
If qrDecompose can't be used this way, what is the recommended way to get the ungrouped object properties from a selection's object:modified event?