@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.
104 lines • 3.69 kB
JavaScript
import { Color, RgbColors } from "../../Colors";
import { EqualsOfFloatNumbers } from "../../Math/Common";
import { EventWithSenderArg } from "../../EventObject";
var ShadowSettings = /** @class */ (function () {
function ShadowSettings(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;
}
Object.defineProperty(ShadowSettings.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(ShadowSettings.prototype, "angle", {
get: function () {
return this._angle;
},
set: function (value) {
if (this._angle === value)
return;
this._angle = value;
this._propertyChanged.notify(this, "angle");
},
enumerable: true,
configurable: true
});
Object.defineProperty(ShadowSettings.prototype, "distance", {
get: function () {
return this._distance;
},
set: function (value) {
if (this._distance === value)
return;
this._distance = value;
this._propertyChanged.notify(this, "distance");
},
enumerable: true,
configurable: true
});
Object.defineProperty(ShadowSettings.prototype, "size", {
get: function () {
return this._size;
},
set: function (value) {
if (this._size === value)
return;
this._size = value;
this._propertyChanged.notify(this, "size");
},
enumerable: true,
configurable: true
});
ShadowSettings.prototype.clone = function () {
return new ShadowSettings(this);
};
ShadowSettings.prototype.equals = function (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);
};
ShadowSettings.equals = function (a, b) {
if (a == null && b == null)
return true;
if (a == null || b == null)
return false;
return a.equals(b);
};
ShadowSettings.prototype.getSimplifiedObject = function () {
return {
color: this.color.getData(),
angle: this.angle,
distance: this.distance,
size: this.size
};
};
ShadowSettings.prototype.addPropertyChanged = function (listener) {
this._propertyChanged.add(listener);
};
ShadowSettings.prototype.removePropertyChanged = function (listener) {
this._propertyChanged.remove(listener);
};
return ShadowSettings;
}());
export { ShadowSettings };
//# sourceMappingURL=ShadowSettings.js.map