@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.
135 lines • 6.43 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 __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { EqualsOfFloatNumbers, PointF } from "../../Math";
import { BaseTextItem } from "./BaseTextItem";
import { equals } from "../../Utils/Utils";
import { InvalidOperationException } from "../../Exception";
import { Property } from "../Decorators";
var MAX_LINE_CONST = 1;
var ArchedTextItem = /** @class */ (function (_super) {
__extends(ArchedTextItem, _super);
function ArchedTextItem(text, center, fontPostScriptName, fontSize) {
var _this = _super.call(this, text, fontPostScriptName, fontSize) || this;
_this._center = new PointF();
_this.type = ArchedTextItem.type;
if (center != null)
_this._center = center;
_this._ignorePermissionsChange = true;
_this.manipulationPermissions.resizeGrips.setCornerArbitrary(false);
_this.manipulationPermissions.resizeGrips.edge = false;
_this.textPermissions.allowChangeTextAlignment = false;
_this.textPermissions.allowChangeLeading = false;
_this._ignorePermissionsChange = false;
return _this;
}
ArchedTextItem.prototype.applyPermissionsConstrain = function () {
_super.prototype.applyPermissionsConstrain.call(this);
if (this.manipulationPermissions != null && this.manipulationPermissions.resizeGrips != null) {
this.manipulationPermissions.resizeGrips.setCornerArbitraryConstraint(false);
this.manipulationPermissions.resizeGrips.edgeConstraint = false;
}
if (this.textPermissions != null) {
this.textPermissions.allowChangeLeading = false;
this.textPermissions.allowChangeTextAlignment = false;
}
};
Object.defineProperty(ArchedTextItem.prototype, "center", {
get: function () { return this._center; },
set: function (value) {
if (PointF.isEqual(this._center, value))
return;
this._center = value;
this._propertyChanged.notify(this, "center");
},
enumerable: true,
configurable: true
});
Object.defineProperty(ArchedTextItem.prototype, "bend", {
get: function () { return this._bend; },
set: function (value) {
if (EqualsOfFloatNumbers(this._bend, value))
return;
this._bend = value;
this._propertyChanged.notify(this, "bend");
},
enumerable: true,
configurable: true
});
Object.defineProperty(ArchedTextItem.prototype, "warp", {
get: function () { return this._warp; },
set: function (value) {
if (this._warp === value)
return;
this._warp = value;
this._propertyChanged.notify(this, "warp");
},
enumerable: true,
configurable: true
});
Object.defineProperty(ArchedTextItem.prototype, "maxLineCount", {
/**
* @override getter in BaseTextItem
* @returns {number} Returns ths._maxLineCount
*/
get: function () { return MAX_LINE_CONST; },
set: function (value) {
console.error("ArchedText set maxLineCount", value);
throw new InvalidOperationException("Max Line Count of ArchedTextItem can not be redefined!");
},
enumerable: true,
configurable: true
});
ArchedTextItem.prototype.getSimplifiedObject = function (omitProperties) {
return _super.prototype.getSimplifiedObject.call(this, ["maxLineCount"].concat(omitProperties));
};
ArchedTextItem.prototype._copy = function (source, destination, generateNewIds, appropriateParentContainer) {
_super.prototype._copy.call(this, source, destination, generateNewIds, appropriateParentContainer);
if (destination instanceof ArchedTextItem) {
destination.center = source.center;
destination.bend = source.bend;
destination.warp = source.warp;
}
};
ArchedTextItem.prototype.equals = function (other) {
return _super.prototype.equals.call(this, other) &&
equals(this._center, other._center) &&
equals(this._bend, other._bend) &&
equals(this._warp, other._warp);
};
ArchedTextItem.prototype.clone = function (generateNewIds, appropriateParentContainer) {
if (generateNewIds === void 0) { generateNewIds = false; }
if (appropriateParentContainer === void 0) { appropriateParentContainer = false; }
var item = new ArchedTextItem();
this._copy(this, item, generateNewIds, appropriateParentContainer);
return item;
};
ArchedTextItem.type = "ArchedTextItem";
__decorate([
Property({ type: "boolean" }),
__metadata("design:type", Boolean),
__metadata("design:paramtypes", [Boolean])
], ArchedTextItem.prototype, "warp", null);
return ArchedTextItem;
}(BaseTextItem));
export { ArchedTextItem };
//# sourceMappingURL=ArchedTextItem.js.map