@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.
77 lines • 3.56 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 { BaseTextItem } from "./BaseTextItem";
import { RectangleF } from "../../Math";
import { equals } from "../../Utils/Utils";
var AutoScaledTextItem = /** @class */ (function (_super) {
__extends(AutoScaledTextItem, _super);
function AutoScaledTextItem(text, rectangle, fontPostScriptName, fontSize) {
var _this = _super.call(this, text, fontPostScriptName, fontSize) || this;
_this._isVertical = false;
_this.type = AutoScaledTextItem.type;
_this._textRectangle = rectangle != null ? rectangle : new RectangleF();
return _this;
}
Object.defineProperty(AutoScaledTextItem.prototype, "textRectangle", {
get: function () {
return this._textRectangle;
},
set: function (value) {
if (RectangleF.isEqual(this._textRectangle, value))
return;
this._textRectangle = value;
this._propertyChanged.notify(this, "textRectangle");
},
enumerable: true,
configurable: true
});
Object.defineProperty(AutoScaledTextItem.prototype, "isVertical", {
get: function () {
return this._isVertical;
},
set: function (value) {
if (this._isVertical === value)
return;
this._isVertical = value;
this._propertyChanged.notify(this, "isVertical");
},
enumerable: true,
configurable: true
});
AutoScaledTextItem.prototype._copy = function (source, destination, generateNewIds, appropriateParentContainer) {
_super.prototype._copy.call(this, source, destination, generateNewIds, appropriateParentContainer);
if (destination.type == "AutoScaledTextItem" || destination.type == "BoundedTextItem" || destination.type == "PathBoundedTextItem" || destination.type == "PlainTextItem") {
destination["isVertical"] = source.isVertical;
}
if (destination instanceof AutoScaledTextItem) {
destination.textRectangle = source.textRectangle;
}
};
AutoScaledTextItem.prototype.equals = function (other) {
return _super.prototype.equals.call(this, other) &&
equals(this._isVertical, other._isVertical) &&
equals(this._textRectangle, other._textRectangle);
};
AutoScaledTextItem.prototype.clone = function (generateNewIds, appropriateParentContainer) {
if (generateNewIds === void 0) { generateNewIds = false; }
if (appropriateParentContainer === void 0) { appropriateParentContainer = false; }
var item = new AutoScaledTextItem();
this._copy(this, item, generateNewIds, appropriateParentContainer);
return item;
};
AutoScaledTextItem.type = "AutoScaledTextItem";
return AutoScaledTextItem;
}(BaseTextItem));
export { AutoScaledTextItem };
//# sourceMappingURL=AutoScaledTextItem.js.map