UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

30 lines 1.39 kB
import { ShapeItemHandler } from "./ShapeItemHandler"; import { PointF, Path } from "@aurigma/design-atoms-model/Math"; export class RectangleItemHandler extends ShapeItemHandler { constructor(item, textWhizz = null, apiClient, colorPreviewService) { if (item != null) { super(Path.rectangle(item.sourceRectangle.left, item.sourceRectangle.top, item.sourceRectangle.width, item.sourceRectangle.height), item, textWhizz, apiClient, colorPreviewService); this._controlPoints = [ new PointF(item.sourceRectangle.left, item.sourceRectangle.top), new PointF(item.sourceRectangle.right, item.sourceRectangle.bottom) ]; } else super(null, item, textWhizz); this._allowNegativeResize = true; } setRectangle(rectangle, supressOnChanged) { rectangle.width = Math.abs(rectangle.width); rectangle.height = Math.abs(rectangle.height); super.setRectangle(rectangle, supressOnChanged); } get _isReadyToDraw() { return this._areColorPreviewsReady; } _setDataItem(item, itemHandlerData) { super._setDataItem(item, itemHandlerData); this.item.sourceRectangle = item.sourceRectangle; } } RectangleItemHandler.typeName = "RectangleItemHandler"; //# sourceMappingURL=RectangleItemHandler.js.map