2014-02-09 52 views
-1

我正在使用fabricjs作爲圖形應用程序。用戶界面從服務器端加載多個圖像。服務器端加載一個位圖,然後旋轉它,並將旋轉後的圖像發送到fabricjs。Fabricjs計算圖像的角度

我想要做的是找出用戶是否旋轉圖像,因爲它是在服務器旋轉它之前。服務器側的旋轉角度是已知的。

我想知道是否有人知道如何計算fabricjs中的角度或者是否有人可以提出解決此問題的方法。

在此先感謝。

回答

1

,你可以很容易地得到與getAngle()方法..

selectedObject = canvas.getActiveObject(); 
    selectedObject.getAngle(); 
0

您可以添加更多的東西JSON文件,以獲得類似的

topLeftCornerX:  toFixed(this.oCoords.tl.x, NUM_FRACTION_DIGITS), 
topLeftCornerY:  toFixed(this.oCoords.tl.y, NUM_FRACTION_DIGITS), 
topRightCornerX: toFixed(this.oCoords.tr.x, NUM_FRACTION_DIGITS), 
topRightCornerY: toFixed(this.oCoords.tr.y, NUM_FRACTION_DIGITS), 
bottomLeftCornerX: toFixed(this.oCoords.bl.x, NUM_FRACTION_DIGITS), 
bottomLeftCornerY: toFixed(this.oCoords.bl.y, NUM_FRACTION_DIGITS), 
bottomRightCornerX: toFixed(this.oCoords.br.x, NUM_FRACTION_DIGITS), 
bottomRightCornerY: toFixed(this.oCoords.br.y, NUM_FRACTION_DIGITS), 

所有電源線和閱讀你將有更多的點得到適當的角度。 希望這會對你有用