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.

98 lines 4 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, RgbColor } from "../../Colors"; import * as Math from "../../Math/Common"; import { equals, arrayEquals } from "../../Utils/Utils"; var PolylineItem = /** @class */ (function (_super) { __extends(PolylineItem, _super); function PolylineItem(points) { var _this = _super.call(this) || this; _this._width = 20; _this._color = new RgbColor(255, 255, 61, 255); _this._points = []; _this.type = PolylineItem.type; _this._points = []; if (points && points.length && points.length > 0) { for (var i = 0; i < points.length; i++) { if (points[i] instanceof PointF) _this._points.push(points[i]); } } _this.textWrappingMode = WrappingMode.None; return _this; } Object.defineProperty(PolylineItem.prototype, "width", { get: function () { return this._width; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._width, value)) return; this._width = value; this._propertyChanged.notify(this, "width"); }, enumerable: true, configurable: true }); Object.defineProperty(PolylineItem.prototype, "color", { get: function () { return this._color; }, set: function (value) { if (Color.equals(this._color, value)) return; this._color = value; this._propertyChanged.notify(this, "color"); }, enumerable: true, configurable: true }); Object.defineProperty(PolylineItem.prototype, "sourcePoints", { get: function () { return this._points; }, set: function (value) { this._points = value; this._propertyChanged.notify(this, "sourcePoints"); }, enumerable: true, configurable: true }); PolylineItem.prototype._copy = function (source, destination, generateNewIds, appropriateParentContainer) { _super.prototype._copy.call(this, source, destination, generateNewIds, appropriateParentContainer); destination.width = source.width; destination.color = source.color.clone(); destination.sourcePoints = source.sourcePoints.map(function (p) { return p.clone(); }); }; PolylineItem.prototype.equals = function (other) { return _super.prototype.equals.call(this, other) && equals(this._width, other._width) && equals(this._color, other._color) && arrayEquals(this._points, other._points); }; PolylineItem.prototype.clone = function (generateNewIds, appropriateParentContainer) { if (generateNewIds === void 0) { generateNewIds = false; } if (appropriateParentContainer === void 0) { appropriateParentContainer = false; } var item = new PolylineItem(); this._copy(this, item, generateNewIds, appropriateParentContainer); return item; }; PolylineItem.type = "PolylineItem"; return PolylineItem; }(Item)); export { PolylineItem }; //# sourceMappingURL=PolylineItem.js.map