问题
I'm trying to set fabric up so the origin is bottom left instead of top left. Currently I'm using setViewportTransform and it transforms everything as I want, except for the selection box. (doesn't seem to get the transformation) I made a fiddle & you can see how if you rotate the rectangle, the selection box rotates the wrong way.
So my question is, how do I set fabric.js' origin to the bottom left?
http://jsfiddle.net/39up3jcm/105/
回答1:
The simplest solution I found was to:
- Change the view by adding
transform: scaleY(-1)to the canvas CSS - Change the inputs by redefining
fabric.Canvas.prototype.getPointerbut replacepointer.y = pointer.y - this._offset.topwithpointer.y = bounds.height - pointer.y + this._offset.top
** Fabric version 1.7.20
来源:https://stackoverflow.com/questions/50283319/how-do-i-properly-transform-entire-canvas-in-fabric-js-change-fabrics-origin