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.

190 lines 7.44 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); 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"; var GridItem = /** @class */ (function (_super) { __extends(GridItem, _super); function GridItem(x, y, cols, rows, stepX, stepY) { var _this = _super.call(this) || this; _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; return _this; } Object.defineProperty(GridItem.prototype, "location", { get: function () { return this._location; }, set: function (value) { if (PointF.isEqual(this._location, value)) return; this._location = value; this._propertyChanged.notify(this, "location"); }, enumerable: true, configurable: true }); Object.defineProperty(GridItem.prototype, "cols", { get: function () { return this._cols; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._cols, value)) return; this._cols = value; this._propertyChanged.notify(this, "cols"); }, enumerable: true, configurable: true }); Object.defineProperty(GridItem.prototype, "rows", { get: function () { return this._rows; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._rows, value)) return; this._rows = value; this._propertyChanged.notify(this, "rows"); }, enumerable: true, configurable: true }); Object.defineProperty(GridItem.prototype, "stepX", { get: function () { return this._stepX; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._stepX, value)) return; this._stepX = value; this._propertyChanged.notify(this, "stepX"); }, enumerable: true, configurable: true }); Object.defineProperty(GridItem.prototype, "stepY", { get: function () { return this._stepY; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._stepY, value)) return; this._stepY = value; this._propertyChanged.notify(this, "stepY"); }, enumerable: true, configurable: true }); Object.defineProperty(GridItem.prototype, "lineWidth", { get: function () { return this._lineWidth; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._lineWidth, value)) return; this._lineWidth = value; this._propertyChanged.notify(this, "lineWidth"); }, enumerable: true, configurable: true }); Object.defineProperty(GridItem.prototype, "fixedLineWidth", { get: function () { return this._fixedLineWidth; }, set: function (value) { if (this._fixedLineWidth === value) return; this._fixedLineWidth = value; this._propertyChanged.notify(this, "fixedLineWidth"); }, enumerable: true, configurable: true }); Object.defineProperty(GridItem.prototype, "verticalLineColor", { get: function () { return this._verticalLineColor; }, set: function (value) { if (Color.equals(this._verticalLineColor, value)) return; this._verticalLineColor = value; this._propertyChanged.notify(this, "verticalLineColor"); }, enumerable: true, configurable: true }); Object.defineProperty(GridItem.prototype, "horizontalLineColor", { get: function () { return this._horizontalLineColor; }, set: function (value) { if (Color.equals(this._horizontalLineColor, value)) return; this._horizontalLineColor = value; this._propertyChanged.notify(this, "horizontalLineColor"); }, enumerable: true, configurable: true }); GridItem.prototype._copy = function (source, destination, generateNewIds, appropriateParentContainer) { _super.prototype._copy.call(this, 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(); }; GridItem.prototype.equals = function (other) { var superEquals = _super.prototype.equals.call(this, 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); }; GridItem.prototype.clone = function (generateNewIds, appropriateParentContainer) { if (generateNewIds === void 0) { generateNewIds = false; } if (appropriateParentContainer === void 0) { appropriateParentContainer = false; } var 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"; return GridItem; }(Item)); export { GridItem }; //# sourceMappingURL=GridItem.js.map