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.

45 lines 1.63 kB
export class TextEditorRenderer { constructor(canvas, textRenderer) { this._canvas = canvas; this._textRenderer = textRenderer; this._itemHandler = null; } set textRenderer(value) { this._textRenderer = value; } initialize(itemHandler) { this._itemHandler = itemHandler; } //# region - ITextEditorRenderer - drawText(textHandler) { const transform = this._itemHandler.item.transform; const previewScale = this._itemHandler.item.previewScale; const controlCenter = this._itemHandler.getControlCenter(); const opacity = this._itemHandler.item.opacity; const clippingPath = null; this._textRenderer.drawText(textHandler, transform, controlCenter, previewScale, opacity, clippingPath); } drawFrame() { this._canvas.redrawDesign(); } drawSelection(textHandler, selection) { if (selection.isValid()) { const transform = this._itemHandler.item.transform; const previewScale = this._itemHandler.item.previewScale; const controlCenter = this._itemHandler.getControlCenter(); this._textRenderer.drawSelection(textHandler, selection, transform, controlCenter, previewScale); } else this.drawText(textHandler); } drawCursor(callback) { this._canvas.drawTextCursor(callback); } clearCursor() { this._canvas.clearTextCursor(); } drawDesign() { this._canvas.redrawDesign(); } } //# sourceMappingURL=TextEditorRenderer.js.map