@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.
110 lines • 4.4 kB
JavaScript
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, RgbColors } from "../../Colors";
import { EqualsOfFloatNumbers } from "../../Math/Common";
import { EventWithSenderArg } from "../../EventObject";
import { Property } from "../Decorators/Property";
export var LineJoin;
(function (LineJoin) {
LineJoin["Miter"] = "Miter";
LineJoin["Round"] = "Round";
LineJoin["Bevel"] = "Bevel";
})(LineJoin || (LineJoin = {}));
var StrokeSettings = /** @class */ (function () {
function StrokeSettings(object) {
this._color = RgbColors.black;
this._size = 0;
this._lineJoin = LineJoin.Miter;
this.type = StrokeSettings.type;
this._propertyChanged = new EventWithSenderArg();
if (object == null)
return;
this.color = object.color != null ? object.color : RgbColors.black;
this.size = object.size != null ? object.size : 0;
this.lineJoin = object.lineJoin != null ? object.lineJoin : LineJoin.Miter;
}
Object.defineProperty(StrokeSettings.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(StrokeSettings.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
});
Object.defineProperty(StrokeSettings.prototype, "lineJoin", {
get: function () {
return this._lineJoin;
},
set: function (value) {
if (this._lineJoin === value)
return;
this._lineJoin = value;
this._propertyChanged.notify(this, "lineJoin");
},
enumerable: true,
configurable: true
});
StrokeSettings.prototype.clone = function () {
return new StrokeSettings(this);
};
StrokeSettings.prototype.equals = function (settings) {
return settings instanceof StrokeSettings &&
this.color.equals(settings.color) &&
EqualsOfFloatNumbers(this.size, settings.size) &&
this.lineJoin == settings.lineJoin;
};
StrokeSettings.equals = function (a, b) {
if (a == null && b == null)
return true;
if (a == null || b == null)
return false;
return a.equals(b);
};
StrokeSettings.prototype.getSimplifiedObject = function () {
return {
color: this.color.getData(),
size: this.size,
lineJoin: this.lineJoin
};
};
StrokeSettings.prototype.addPropertyChanged = function (listener) {
this._propertyChanged.add(listener);
};
StrokeSettings.prototype.removePropertyChanged = function (listener) {
this._propertyChanged.remove(listener);
};
StrokeSettings.type = "StrokeSettings";
__decorate([
Property({ enumObject: LineJoin }),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], StrokeSettings.prototype, "lineJoin", null);
return StrokeSettings;
}());
export { StrokeSettings };
//# sourceMappingURL=StrokeSettings.js.map