This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getZoomCompensatedBoundingRect(fabricObject){ | |
//fabricObject is the object you want to get the boundingRect from | |
fabricObject.setCoords(); | |
var boundingRect = fabricObject.getBoundingRect(); | |
var zoom = canvas.getZoom(); | |
var viewportMatrix = canvas.viewportTransform; | |
//there is a bug in fabric that causes bounding rects to not be transformed by viewport matrix | |
//this code should compensate for the bug for now |