@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.
102 lines • 4.92 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 { PointF } from "../../Math/PointF";
import { equals } from "../../Utils/Utils";
var PlainTextItem = /** @class */ (function (_super) {
__extends(PlainTextItem, _super);
function PlainTextItem(text, location, postScriptFontName, fontSize) {
var _this = _super.call(this, text, postScriptFontName, fontSize) || this;
_this._baselineLocation = new PointF();
_this._isVertical = false;
_this.type = PlainTextItem.type;
if (location != null)
_this.baselineLocation = location;
_this._ignorePermissionsChange = true;
_this.manipulationPermissions.resizeGrips.setCornerArbitrary(false);
_this.manipulationPermissions.resizeGrips.edge = false;
_this._ignorePermissionsChange = false;
return _this;
}
Object.defineProperty(PlainTextItem.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
});
Object.defineProperty(PlainTextItem.prototype, "baselineLocation", {
get: function () {
return this._baselineLocation;
},
set: function (value) {
this.setBaselineLocation(value);
},
enumerable: true,
configurable: true
});
PlainTextItem.prototype.setBaselineLocation = function (value, suppressPropertyChanged) {
if (suppressPropertyChanged === void 0) { suppressPropertyChanged = false; }
if (PointF.isEqual(this._baselineLocation, value))
return;
this._baselineLocation = value;
if (!suppressPropertyChanged)
this._propertyChanged.notify(this, "baselineLocation");
};
PlainTextItem.prototype.applyPermissionsConstrain = function () {
_super.prototype.applyPermissionsConstrain.call(this);
if (this.manipulationPermissions != null && this.manipulationPermissions.resizeGrips != null) {
this.manipulationPermissions.resizeGrips.setCornerArbitrary(false);
this.manipulationPermissions.resizeGrips.edgeConstraint = false;
}
};
PlainTextItem.prototype.getSimplifiedObject = function (omitProperties) {
if (omitProperties === void 0) { omitProperties = []; }
var simplified = _super.prototype.getSimplifiedObject.call(this, ["_placeholders", "currentTextImage", "sourcePath", "sourceRectangle"].concat(omitProperties));
simplified["placeholders"] = this.placeholders.toArray();
return simplified;
};
PlainTextItem.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 PlainTextItem) {
destination.baselineLocation = source.baselineLocation;
}
return destination;
};
PlainTextItem.prototype.equals = function (other) {
return _super.prototype.equals.call(this, other) &&
equals(this._isVertical, other._isVertical) &&
equals(this._baselineLocation, other._baselineLocation);
};
PlainTextItem.prototype.clone = function (generateNewIds, appropriateParentContainer) {
if (generateNewIds === void 0) { generateNewIds = false; }
if (appropriateParentContainer === void 0) { appropriateParentContainer = false; }
var item = new PlainTextItem();
this._copy(this, item, generateNewIds, appropriateParentContainer);
return item;
};
PlainTextItem.type = "PlainTextItem";
return PlainTextItem;
}(BaseTextItem));
export { PlainTextItem };
//# sourceMappingURL=PlainTextItem.js.map