@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.
42 lines • 1.32 kB
JavaScript
import { Color } from "./Color";
import { validateComponent, validateStringProperty } from "./ValidationUtils";
export class Ink {
constructor(name, alternativeColor, solidity = 1) {
this._name = validateStringProperty(name);
this._alternativeColor = alternativeColor;
this._solidity = validateComponent(solidity, 0, 1);
}
get name() {
return this._name;
}
get alternativeColor() {
return this._alternativeColor;
}
get solidity() {
return this._solidity;
}
static equals(a, b) {
if (a == null && b == null)
return true;
if (a == null || b == null)
return false;
return a.equals(b);
}
equals(other) {
return this.name === other.name
&& this.solidity === other.solidity
&& Color.equals(this.alternativeColor, other.alternativeColor);
}
clone() {
return new Ink(this.name, this.alternativeColor, this.solidity);
}
getData() {
var _a;
return {
name: this.name,
alternativeColor: (_a = this.alternativeColor) === null || _a === void 0 ? void 0 : _a.getData(),
solidity: this.solidity
};
}
}
//# sourceMappingURL=Ink.js.map