@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
53 lines • 2.59 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 { ShapeItemHandler } from "./ShapeItemHandler";
import { PointF, Path } from "@aurigma/design-atoms-model/Math";
var RectangleItemHandler = /** @class */ (function (_super) {
__extends(RectangleItemHandler, _super);
function RectangleItemHandler(item, textWhizz, apiClient, colorPreviewService) {
if (textWhizz === void 0) { textWhizz = null; }
var _this = this;
if (item != null) {
_this = _super.call(this, Path.rectangle(item.sourceRectangle.left, item.sourceRectangle.top, item.sourceRectangle.width, item.sourceRectangle.height), item, textWhizz, apiClient, colorPreviewService) || this;
_this._controlPoints = [
new PointF(item.sourceRectangle.left, item.sourceRectangle.top),
new PointF(item.sourceRectangle.right, item.sourceRectangle.bottom)
];
}
else
_this = _super.call(this, null, item, textWhizz) || this;
_this._allowNegativeResize = true;
return _this;
}
RectangleItemHandler.prototype.setRectangle = function (rectangle, supressOnChanged) {
rectangle.width = Math.abs(rectangle.width);
rectangle.height = Math.abs(rectangle.height);
_super.prototype.setRectangle.call(this, rectangle, supressOnChanged);
};
Object.defineProperty(RectangleItemHandler.prototype, "_isReadyToDraw", {
get: function () {
return this._areColorPreviewsReady;
},
enumerable: true,
configurable: true
});
RectangleItemHandler.prototype._setDataItem = function (item, itemHandlerData) {
_super.prototype._setDataItem.call(this, item, itemHandlerData);
this.item.sourceRectangle = item.sourceRectangle;
};
RectangleItemHandler.typeName = "RectangleItemHandler";
return RectangleItemHandler;
}(ShapeItemHandler));
export { RectangleItemHandler };
//# sourceMappingURL=RectangleItemHandler.js.map