@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.
100 lines • 4.52 kB
JavaScript
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";
const MAX_LINE_CONST = 1;
export class ArchedTextItem extends BaseTextItem {
constructor(text, center, fontPostScriptName, fontSize) {
super(text, fontPostScriptName, fontSize);
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;
}
applyPermissionsConstrain() {
super.applyPermissionsConstrain();
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;
}
}
get center() { return this._center; }
set center(value) {
if (PointF.isEqual(this._center, value))
return;
this._center = value;
this._propertyChanged.notify(this, "center");
}
get bend() { return this._bend; }
set bend(value) {
if (EqualsOfFloatNumbers(this._bend, value))
return;
this._bend = value;
this._propertyChanged.notify(this, "bend");
}
get warp() { return this._warp; }
set warp(value) {
if (this._warp === value)
return;
this._warp = value;
this._propertyChanged.notify(this, "warp");
}
/**
* @override getter in BaseTextItem
* @returns {number} Returns ths._maxLineCount
*/
get maxLineCount() { return MAX_LINE_CONST; }
set maxLineCount(value) {
console.error("ArchedText set maxLineCount", value);
throw new InvalidOperationException("Max Line Count of ArchedTextItem can not be redefined!");
}
getSimplifiedObject(omitProperties) {
return super.getSimplifiedObject(["maxLineCount"].concat(omitProperties));
}
_copy(source, destination, generateNewIds, appropriateParentContainer) {
super._copy(source, destination, generateNewIds, appropriateParentContainer);
if (destination instanceof ArchedTextItem) {
destination.center = source.center;
destination.bend = source.bend;
destination.warp = source.warp;
}
}
equals(other) {
return super.equals(other) &&
equals(this._center, other._center) &&
equals(this._bend, other._bend) &&
equals(this._warp, other._warp);
}
clone(generateNewIds = false, appropriateParentContainer = false) {
const 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);
//# sourceMappingURL=ArchedTextItem.js.map