@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.
39 lines • 1.3 kB
JavaScript
import { EqualsOfFloatNumbers } from "../../Math";
export class MaxArtworkSizeConstraints {
constructor() {
this.width = null;
this.height = null;
this.shapeType = null;
}
get isCircle() {
const isEllipse = this.shapeType === "ellipse";
const isEqualSides = EqualsOfFloatNumbers(this.width, this.height);
return isEllipse && isEqualSides;
}
get isEllipse() {
const isEllipse = this.shapeType === "ellipse";
const isNotEqualSides = this.width != this.height;
return isEllipse && isNotEqualSides;
}
get isRectangle() {
return this.shapeType == "rectangle";
}
_copy(source, destination) {
destination.width = source.width != null ? source.width : null;
destination.height = source.height != null ? source.height : null;
destination.shapeType = source.shapeType;
}
clone() {
const constraints = new MaxArtworkSizeConstraints();
this._copy(this, constraints);
return constraints;
}
toJSON() {
return {
width: this.width,
height: this.height,
shapeType: this.shapeType,
};
}
}
//# sourceMappingURL=MaxArtworkSizeConstraints.js.map