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.

123 lines 5.24 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 { EqualsOfFloatNumbers } from "./Common"; import { EventWithSenderArg } from "../EventObject"; import { ModelComponent } from "../Product/ModelComponent"; var Margin = /** @class */ (function (_super) { __extends(Margin, _super); function Margin(value) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; var _this = _super.call(this) || this; _this._propertyChanged = new EventWithSenderArg(); var rawValue = value; _this._left = (_c = (_b = (_a = rawValue === null || rawValue === void 0 ? void 0 : rawValue.left) !== null && _a !== void 0 ? _a : rawValue === null || rawValue === void 0 ? void 0 : rawValue.horizontal) !== null && _b !== void 0 ? _b : rawValue) !== null && _c !== void 0 ? _c : 0; _this._top = (_f = (_e = (_d = rawValue === null || rawValue === void 0 ? void 0 : rawValue.top) !== null && _d !== void 0 ? _d : rawValue === null || rawValue === void 0 ? void 0 : rawValue.vertical) !== null && _e !== void 0 ? _e : rawValue) !== null && _f !== void 0 ? _f : 0; _this._right = (_j = (_h = (_g = rawValue === null || rawValue === void 0 ? void 0 : rawValue.right) !== null && _g !== void 0 ? _g : rawValue === null || rawValue === void 0 ? void 0 : rawValue.horizontal) !== null && _h !== void 0 ? _h : rawValue) !== null && _j !== void 0 ? _j : 0; _this._bottom = (_m = (_l = (_k = rawValue === null || rawValue === void 0 ? void 0 : rawValue.bottom) !== null && _k !== void 0 ? _k : rawValue === null || rawValue === void 0 ? void 0 : rawValue.vertical) !== null && _l !== void 0 ? _l : rawValue) !== null && _m !== void 0 ? _m : 0; return _this; } Object.defineProperty(Margin.prototype, "left", { get: function () { return this._left; }, set: function (value) { if (EqualsOfFloatNumbers(value, this._left)) return; this._left = value; this._propertyChanged.notify(this, "left"); }, enumerable: true, configurable: true }); Object.defineProperty(Margin.prototype, "top", { get: function () { return this._top; }, set: function (value) { if (EqualsOfFloatNumbers(value, this._top)) return; this._top = value; this._propertyChanged.notify(this, "top"); }, enumerable: true, configurable: true }); Object.defineProperty(Margin.prototype, "right", { get: function () { return this._right; }, set: function (value) { if (EqualsOfFloatNumbers(value, this._right)) return; this._right = value; this._propertyChanged.notify(this, "right"); }, enumerable: true, configurable: true }); Object.defineProperty(Margin.prototype, "bottom", { get: function () { return this._bottom; }, set: function (value) { if (EqualsOfFloatNumbers(value, this._bottom)) return; this._bottom = value; this._propertyChanged.notify(this, "bottom"); }, enumerable: true, configurable: true }); Margin.prototype.clone = function () { return new Margin({ left: this.left, top: this.top, right: this.right, bottom: this.bottom }); }; Object.defineProperty(Margin.prototype, "isEmpty", { get: function () { return this._left === 0 && this._top === 0 && this._right === 0 && this._bottom === 0; }, enumerable: true, configurable: true }); Margin.prototype.equals = function (other) { return this.left === other.left && this.top === other.top && this.right === other.right && this.bottom === other.bottom; }; Margin.prototype.getSimplifiedObject = function () { return { left: this.left, top: this.top, right: this.right, bottom: this.bottom }; }; Margin.prototype.addPropertyChanged = function (listener) { this._propertyChanged.add(listener); }; Margin.prototype.removePropertyChanged = function (listener) { this._propertyChanged.remove(listener); }; return Margin; }(ModelComponent)); export { Margin }; //# sourceMappingURL=Margin.js.map