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.

135 lines 4.9 kB
import { Item } from "./Item"; import { PointF } from "../../Math/PointF"; import { WrappingMode } from "./WrappingMode"; import { Color, RgbColors } from "../../Colors"; import * as Math from "../../Math/Common"; import { equals } from "../../Utils/Utils"; export class GridItem extends Item { constructor(x, y, cols, rows, stepX, stepY) { super(); this.type = GridItem.type; this._location = new PointF(x, y); this._cols = cols; this._rows = rows; this._stepX = stepX; this._stepY = stepY; this._horizontalLineColor = RgbColors.black; this._verticalLineColor = RgbColors.black; this._lineWidth = 1; this._fixedLineWidth = true; this.textWrappingMode = WrappingMode.None; } get location() { return this._location; } set location(value) { if (PointF.isEqual(this._location, value)) return; this._location = value; this._propertyChanged.notify(this, "location"); } get cols() { return this._cols; } set cols(value) { if (Math.EqualsOfFloatNumbers(this._cols, value)) return; this._cols = value; this._propertyChanged.notify(this, "cols"); } get rows() { return this._rows; } set rows(value) { if (Math.EqualsOfFloatNumbers(this._rows, value)) return; this._rows = value; this._propertyChanged.notify(this, "rows"); } get stepX() { return this._stepX; } set stepX(value) { if (Math.EqualsOfFloatNumbers(this._stepX, value)) return; this._stepX = value; this._propertyChanged.notify(this, "stepX"); } get stepY() { return this._stepY; } set stepY(value) { if (Math.EqualsOfFloatNumbers(this._stepY, value)) return; this._stepY = value; this._propertyChanged.notify(this, "stepY"); } get lineWidth() { return this._lineWidth; } set lineWidth(value) { if (Math.EqualsOfFloatNumbers(this._lineWidth, value)) return; this._lineWidth = value; this._propertyChanged.notify(this, "lineWidth"); } get fixedLineWidth() { return this._fixedLineWidth; } set fixedLineWidth(value) { if (this._fixedLineWidth === value) return; this._fixedLineWidth = value; this._propertyChanged.notify(this, "fixedLineWidth"); } get verticalLineColor() { return this._verticalLineColor; } set verticalLineColor(value) { if (Color.equals(this._verticalLineColor, value)) return; this._verticalLineColor = value; this._propertyChanged.notify(this, "verticalLineColor"); } get horizontalLineColor() { return this._horizontalLineColor; } set horizontalLineColor(value) { if (Color.equals(this._horizontalLineColor, value)) return; this._horizontalLineColor = value; this._propertyChanged.notify(this, "horizontalLineColor"); } _copy(source, destination, generateNewIds, appropriateParentContainer) { super._copy(source, destination, generateNewIds, appropriateParentContainer); destination.location = source.location.clone(); destination.cols = source.cols; destination.rows = source.rows; destination.stepX = source.stepX; destination.stepY = source.stepY; destination.lineWidth = source.lineWidth; destination.fixedLineWidth = source.fixedLineWidth; destination.verticalLineColor = source.verticalLineColor.clone(); destination.horizontalLineColor = source.horizontalLineColor.clone(); } equals(other) { const superEquals = super.equals(other); return superEquals && equals(this._location, other._location) && equals(this._rows, other._rows) && equals(this._cols, other._cols) && equals(this._stepX, other._stepX) && equals(this._stepY, other._stepY) && equals(this._lineWidth, other._lineWidth) && equals(this._fixedLineWidth, other._fixedLineWidth) && equals(this._verticalLineColor, other._verticalLineColor) && equals(this._horizontalLineColor, other._horizontalLineColor); } clone(generateNewIds = false, appropriateParentContainer = false) { const item = new GridItem(this.location.x, this.location.y, this.cols, this.rows, this.stepX, this.stepY); this._copy(this, item, generateNewIds, appropriateParentContainer); return item; } } GridItem.type = "GridItem"; //# sourceMappingURL=GridItem.js.map