@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.
96 lines • 3.54 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 = {}));
export class StrokeSettings {
get color() {
return this._color;
}
set color(value) {
if (Color.equals(this._color, value))
return;
this._color = value;
this._propertyChanged.notify(this, "color");
}
get size() {
return this._size;
}
set size(value) {
if (this._size === value)
return;
this._size = value;
this._propertyChanged.notify(this, "size");
}
get lineJoin() {
return this._lineJoin;
}
set lineJoin(value) {
if (this._lineJoin === value)
return;
this._lineJoin = value;
this._propertyChanged.notify(this, "lineJoin");
}
constructor(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;
}
clone() {
return new StrokeSettings(this);
}
equals(settings) {
return settings instanceof StrokeSettings &&
this.color.equals(settings.color) &&
EqualsOfFloatNumbers(this.size, settings.size) &&
this.lineJoin == settings.lineJoin;
}
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(),
size: this.size,
lineJoin: this.lineJoin
};
}
addPropertyChanged(listener) {
this._propertyChanged.add(listener);
}
removePropertyChanged(listener) {
this._propertyChanged.remove(listener);
}
}
StrokeSettings.type = "StrokeSettings";
__decorate([
Property({ enumObject: LineJoin }),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], StrokeSettings.prototype, "lineJoin", null);
//# sourceMappingURL=StrokeSettings.js.map