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.

119 lines 5.14 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { Color } from "../../Colors"; import { EqualsOfFloatNumbers } from "../../Math"; import { EventWithSenderArg } from "../../EventObject"; import { Property } from "../Decorators/Property"; import { BlendMode } from "./BlendMode"; import { ColorPropertyFactory, SimplePropertyFactory } from "../Decorators/Factory"; var OverlayEffect = /** @class */ (function () { function OverlayEffect(object) { this._color = null; this._opacity = null; this._blendMode = null; this.$_propertyChanged = new EventWithSenderArg(); this.type = OverlayEffect.type; if (object != null) { var color = object.color, opacity = object.opacity, blendMode = object.blendMode; this.color = color instanceof Color ? color : null; this.blendMode = typeof blendMode === "string" ? blendMode : null; this.opacity = typeof opacity === "number" ? opacity : null; } } OverlayEffect.prototype.equals = function (object) { if (!(object instanceof OverlayEffect)) return false; var color = object.color, opacity = object.opacity, blendMode = object.blendMode; return Color.equals(color, this.color) && (opacity == null && this.opacity == null || EqualsOfFloatNumbers(opacity, this.opacity)) && (blendMode == null && this.blendMode == null || blendMode === this.blendMode); }; OverlayEffect.prototype.getSimplifiedObject = function () { return { "color": this.color, "blendMode": this.blendMode, "opacity": this.opacity }; }; OverlayEffect.equals = function (a, b) { if (a == null && b == null) return true; if (a != null) return a.equals(b); return false; }; OverlayEffect.prototype.clone = function () { return new OverlayEffect({ blendMode: this.blendMode, color: this.color != null ? this.color.clone() : null, opacity: this.opacity }); }; Object.defineProperty(OverlayEffect.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(OverlayEffect.prototype, "blendMode", { get: function () { return this._blendMode; }, set: function (value) { if (this.blendMode === value) return; this._blendMode = value; this.$_propertyChanged.notify(this, "blendMode"); }, enumerable: true, configurable: true }); Object.defineProperty(OverlayEffect.prototype, "opacity", { get: function () { return this._opacity; }, set: function (value) { if (this.opacity === value) return; this._opacity = value; this.$_propertyChanged.notify(this, "opacity"); }, enumerable: true, configurable: true }); OverlayEffect.prototype.addPropertyChanged = function (listener) { this.$_propertyChanged.add(listener); }; OverlayEffect.prototype.removePropertyChanged = function (listener) { this.$_propertyChanged.remove(listener); }; OverlayEffect.type = "OverlayEffect"; __decorate([ Property({ factory: new ColorPropertyFactory() }), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], OverlayEffect.prototype, "color", null); __decorate([ Property({ enumObject: BlendMode }), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], OverlayEffect.prototype, "blendMode", null); __decorate([ Property({ factory: new SimplePropertyFactory(0) }), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], OverlayEffect.prototype, "opacity", null); return OverlayEffect; }()); export { OverlayEffect }; //# sourceMappingURL=OverlayEffect.js.map