UNPKG

@aurigma/design-atoms-model

Version:

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

50 lines 2.1 kB
import { BaseTextItem } from "./BaseTextItem"; import { RectangleF } from "../../Math"; import { equals } from "../../Utils/Utils"; export class AutoScaledTextItem extends BaseTextItem { constructor(text, rectangle, fontPostScriptName, fontSize) { super(text, fontPostScriptName, fontSize); this._isVertical = false; this.type = AutoScaledTextItem.type; this._textRectangle = rectangle != null ? rectangle : new RectangleF(); } get textRectangle() { return this._textRectangle; } set textRectangle(value) { if (RectangleF.isEqual(this._textRectangle, value)) return; this._textRectangle = value; this._propertyChanged.notify(this, "textRectangle"); } get isVertical() { return this._isVertical; } set isVertical(value) { if (this._isVertical === value) return; this._isVertical = value; this._propertyChanged.notify(this, "isVertical"); } _copy(source, destination, generateNewIds, appropriateParentContainer) { super._copy(source, destination, generateNewIds, appropriateParentContainer); if (destination.type == "AutoScaledTextItem" || destination.type == "BoundedTextItem" || destination.type == "PathBoundedTextItem" || destination.type == "PlainTextItem") { destination["isVertical"] = source.isVertical; } if (destination instanceof AutoScaledTextItem) { destination.textRectangle = source.textRectangle; } } equals(other) { return super.equals(other) && equals(this._isVertical, other._isVertical) && equals(this._textRectangle, other._textRectangle); } clone(generateNewIds = false, appropriateParentContainer = false) { const item = new AutoScaledTextItem(); this._copy(this, item, generateNewIds, appropriateParentContainer); return item; } } AutoScaledTextItem.type = "AutoScaledTextItem"; //# sourceMappingURL=AutoScaledTextItem.js.map