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.

86 lines 2.69 kB
import { Color, RgbColors } from "../../Colors"; import { EqualsOfFloatNumbers } from "../../Math/Common"; import { EventWithSenderArg } from "../../EventObject"; export class ShadowSettings { get color() { return this._color; } set color(value) { if (Color.equals(this._color, value)) return; this._color = value; this._propertyChanged.notify(this, "color"); } get angle() { return this._angle; } set angle(value) { if (this._angle === value) return; this._angle = value; this._propertyChanged.notify(this, "angle"); } get distance() { return this._distance; } set distance(value) { if (this._distance === value) return; this._distance = value; this._propertyChanged.notify(this, "distance"); } get size() { return this._size; } set size(value) { if (this._size === value) return; this._size = value; this._propertyChanged.notify(this, "size"); } constructor(object) { this._color = RgbColors.black; this._angle = 0; this._distance = 0; this._size = 0; this._propertyChanged = new EventWithSenderArg(); if (object == null) return; this.color = object.color != null ? object.color : RgbColors.black; this.angle = object.angle != null ? object.angle : 0; this.distance = object.distance != null ? object.distance : 0; this.size = object.size != null ? object.size : 0; } clone() { return new ShadowSettings(this); } equals(settings) { return settings instanceof ShadowSettings && this.color.equals(settings.color) && EqualsOfFloatNumbers(this.angle, settings.angle) && EqualsOfFloatNumbers(this.distance, settings.distance) && EqualsOfFloatNumbers(this.size, settings.size); } static equals(a, b) { if (a == null && b == null) return true; if (a == null || b == null) return false; return a.equals(b); } getSimplifiedObject() { return { color: this.color.getData(), angle: this.angle, distance: this.distance, size: this.size }; } addPropertyChanged(listener) { this._propertyChanged.add(listener); } removePropertyChanged(listener) { this._propertyChanged.remove(listener); } } //# sourceMappingURL=ShadowSettings.js.map