@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.
83 lines • 3.06 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { Utils } from "../ColorsOld";
import { Color } from "./Color";
import { ColorSpace } from "./ColorSpace";
import { Ink } from "./Ink";
import { validateComponent } from "./ValidationUtils";
var SpotColor = /** @class */ (function (_super) {
__extends(SpotColor, _super);
function SpotColor(ink, tint, alpha) {
if (alpha === void 0) { alpha = 255; }
var _this = _super.call(this) || this;
_this._colorSpace = ColorSpace.Spot;
_this._ink = ink;
_this._tint = validateComponent(tint);
_this._alpha = validateComponent(alpha);
return _this;
}
Object.defineProperty(SpotColor.prototype, "ink", {
get: function () {
return this._ink;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SpotColor.prototype, "tint", {
get: function () {
return this._tint;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SpotColor.prototype, "alpha", {
get: function () {
return this._alpha;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SpotColor.prototype, "isTransparent", {
get: function () {
return this.alpha === 0;
},
enumerable: true,
configurable: true
});
SpotColor.prototype.equals = function (other) {
var spotOther = other;
return _super.prototype.equals.call(this, other)
&& Ink.equals(this.ink, spotOther.ink)
&& this.tint === spotOther.tint
&& this.alpha === spotOther.alpha;
};
SpotColor.prototype.clone = function () {
return new SpotColor(this.ink.clone(), this.tint, this.alpha);
};
SpotColor.prototype.getData = function () {
var data = _super.prototype.getData.call(this);
data.ink = this.ink.getData();
data.tint = this.tint;
data.alpha = this.alpha;
return data;
};
SpotColor.prototype.toString = function () {
var altColor = this.ink.alternativeColor.toString();
var tint = Utils.convertByteToPercent(this.tint);
return "spot('" + this.ink.name + "'," + altColor + "," + this.ink.solidity + "," + tint + ")";
};
return SpotColor;
}(Color));
export { SpotColor };
//# sourceMappingURL=SpotColor.js.map