@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
17 lines • 1.02 kB
JavaScript
export function isIncreasingResize(selection, resizeData) {
var dHeight = selection.height - resizeData.previousRectangle.height;
var dWidth = selection.width - resizeData.previousRectangle.width;
var xResizeSign = Math.sign(dWidth * selection.width);
var yResizeSign = Math.sign(dHeight * selection.height);
return yResizeSign > 0 || xResizeSign > 0;
}
export function getSelectionAreaToImageSizeRatio(resizeData, imageHandler) {
var _a, _b, _c, _d;
var widthRatio = (_b = resizeData.startRectangle.width / ((_a = imageHandler.startRectangle) === null || _a === void 0 ? void 0 : _a.width)) !== null && _b !== void 0 ? _b : imageHandler.rectangle.width;
var heightRatio = (_d = resizeData.startRectangle.height / ((_c = imageHandler.startRectangle) === null || _c === void 0 ? void 0 : _c.height)) !== null && _d !== void 0 ? _d : imageHandler.rectangle.height;
return {
width: widthRatio,
height: heightRatio
};
}
//# sourceMappingURL=Utils.js.map