UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

102 lines 4.3 kB
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 { BaseTextItemHandler } from "./BaseTextItemHandler"; import { RotatedRectangleF } from "@aurigma/design-atoms-model/Math"; var AutoScaledTextItemHandler = /** @class */ (function (_super) { __extends(AutoScaledTextItemHandler, _super); function AutoScaledTextItemHandler(item, textWhizz, apiClient, colorPreviewService) { if (textWhizz === void 0) { textWhizz = null; } if (apiClient === void 0) { apiClient = null; } return _super.call(this, item, textWhizz, apiClient, colorPreviewService) || this; } Object.defineProperty(AutoScaledTextItemHandler.prototype, "item", { get: function () { return this._getItem(); }, set: function (item) { _super.prototype._setItem.call(this, item); }, enumerable: true, configurable: true }); Object.defineProperty(AutoScaledTextItemHandler.prototype, "originalTextRectangle", { get: function () { return this.item.textRectangle; }, set: function (value) { this.item.textRectangle = value; }, enumerable: true, configurable: true }); Object.defineProperty(AutoScaledTextItemHandler.prototype, "verticalScale", { get: function () { return this.item.verticalScale; }, enumerable: true, configurable: true }); Object.defineProperty(AutoScaledTextItemHandler.prototype, "horizontalScale", { get: function () { return this.item.horizontalScale; }, enumerable: true, configurable: true }); Object.defineProperty(AutoScaledTextItemHandler.prototype, "isVertical", { get: function () { return this.item.isVertical; }, set: function (value) { this.item.isVertical = value; }, enumerable: true, configurable: true }); AutoScaledTextItemHandler.prototype.getTextRectangle = function () { var center = this.getControlCenter(); var rectangle = RotatedRectangleF.fromRectangleF(this.item.textRectangle); rectangle.transform(this.item.transform.clone(), center); return rectangle.toRectangleF(); }; AutoScaledTextItemHandler.prototype._onItemPropertyChanged = function (sender, propertyName) { switch (propertyName) { case "isVertical": this.update(); break; } _super.prototype._onItemPropertyChanged.call(this, sender, propertyName); }; AutoScaledTextItemHandler.prototype._setDataItem = function (item, itemHandlerData) { _super.prototype._setDataItem.call(this, item, itemHandlerData); this.item.textRectangle = item.textRectangle; this.item.isVertical = item.isVertical; }; AutoScaledTextItemHandler.prototype._updateEmptyTextControlPoints = function () { var textRectangle = this.item.textRectangle; this._controlPoints[0].x = textRectangle.left; this._controlPoints[0].y = textRectangle.top; this._controlPoints[1].x = textRectangle.right; this._controlPoints[1].y = textRectangle.bottom; var canvas = this.canvas; if (canvas != null) canvas.redraw(); }; AutoScaledTextItemHandler.prototype._setDefaultTextControlPoints = function () { }; AutoScaledTextItemHandler.typeName = "AutoScaledTextItemHandler"; return AutoScaledTextItemHandler; }(BaseTextItemHandler)); export { AutoScaledTextItemHandler }; //# sourceMappingURL=AutoScaledTextItemHandler.js.map