@aurigma/design-atoms
Advanced tools
Comparing version 6.23.9 to 6.23.10
@@ -480,2 +480,3 @@ import { ItemHandler } from "./ItemHandlers/ItemHandler"; | ||
get isUpdating(): boolean; | ||
get contentAngle(): number; | ||
initialize(): void; | ||
@@ -482,0 +483,0 @@ checkReady(): void; |
@@ -37,3 +37,3 @@ import { EventWithSenderArg } from "@aurigma/design-atoms-model/EventObject"; | ||
clearText(): void; | ||
updateText(source: string): Promise<void>; | ||
updateText(source: string, force?: boolean): Promise<void>; | ||
transformText(transform: Transform): void; | ||
@@ -40,0 +40,0 @@ measureText(extendToBlackBox?: boolean): RectangleF; |
@@ -66,3 +66,3 @@ import { RectangleF, Transform } from "@aurigma/design-atoms-model/Math"; | ||
clearText(): void; | ||
updateText(trigger: string): Promise<void>; | ||
updateText(trigger: string, force?: boolean): Promise<void>; | ||
transformText(transform: Transform): void; | ||
@@ -83,3 +83,2 @@ measureText(extendToBlackBox?: boolean): RectangleF; | ||
private _unbindFromEditor; | ||
private _getListSettingFromConfig; | ||
private _onSelectedItemHandlerChanged; | ||
@@ -86,0 +85,0 @@ private _onCanvasSelectionLocked; |
@@ -63,3 +63,3 @@ var __assign = (this && this.__assign) || function () { | ||
import { ItemUtils } from "../Utils/ItemUtils"; | ||
import { Cursor } from "../Utils/Common"; | ||
import { Cursor, Utils } from "../Utils/Common"; | ||
import { MouseCommandType } from "./MouseCommandType"; | ||
@@ -190,3 +190,3 @@ import { MobileTextEditor } from "@aurigma/design-atoms-text/TextEditor/MobileTextEditor"; | ||
this._activeTextCanvasHandler = this._canvas.activeTextCanvasHandler; | ||
this._listStyleSheetManagerFactory = new ListStyleSheetManagerFactory(this._getListSettingFromConfig(this._canvas.viewer.configuration.listSettings)); | ||
this._listStyleSheetManagerFactory = new ListStyleSheetManagerFactory(Utils.getListSettingFromConfig(this._canvas.viewer.configuration.listSettings)); | ||
this._listStyleSheetManager = this._listStyleSheetManagerFactory.create(); | ||
@@ -375,3 +375,3 @@ this._colorPreviewService = this._itemHandler.colorPreviewService; | ||
point = { x: x, y: y }; | ||
if (!(this._textEditor instanceof NewTextEditor && !this._itemHandler.item.transform.isEmpty)) return [3 /*break*/, 2]; | ||
if (!!this._itemHandler.item.transform.isEmpty) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this._itemHandler.frontEndUpdate()]; | ||
@@ -440,3 +440,4 @@ case 1: | ||
} | ||
this._itemHandler.updateRectangle(handlerRect); | ||
this._itemHandler.updateRectangle(handlerRect, true); | ||
this._tw.textHandler.setTextFrames(this._itemHandler.getFramesData(), false); | ||
this._canvas.redrawDesign(); | ||
@@ -450,6 +451,6 @@ } | ||
updateRect.height = frame.height + 1.5; | ||
this._itemHandler.updateRectangle(updateRect); | ||
this._itemHandler.updateRectangle(updateRect, true); | ||
} | ||
else { | ||
this._itemHandler.updateRectangle(this._initialBoundedRect); | ||
this._itemHandler.updateRectangle(this._initialBoundedRect, true); | ||
} | ||
@@ -536,2 +537,5 @@ } | ||
case 3: | ||
if (this._canvas.viewer.configuration.rotatedTextInPlaceEditEnabled === false && ItemUtils.isRotated(this._itemHandler.item, this._canvas.contentAngle)) { | ||
return [2 /*return*/, false]; | ||
} | ||
if (this.isMobile && !this._textEditor.isReady) { | ||
@@ -568,7 +572,8 @@ this._textEditor.editorInitialized.remove(this._onMobileTextEditorInitialized); | ||
}; | ||
TextEditorController.prototype.updateText = function (trigger) { | ||
TextEditorController.prototype.updateText = function (trigger, force) { | ||
if (force === void 0) { force = false; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this._updateText(this._getUpdateTextTrigger(trigger))]; | ||
case 0: return [4 /*yield*/, this._updateText(this._getUpdateTextTrigger(trigger), force)]; | ||
case 1: | ||
@@ -769,23 +774,2 @@ _a.sent(); | ||
}; | ||
TextEditorController.prototype._getListSettingFromConfig = function (config) { | ||
return config ? { | ||
maxNestingListLevel: config.maxLevel, | ||
defOrderedListLevelGap: config.levelIndent, | ||
defUnorderedListLevelGap: config.levelIndent, | ||
defOrderedListStyle: { | ||
firstLineIndent: config.firstLineIndent, | ||
leftIndent: config.listIndent, | ||
tabOffset: config.tabOffset, | ||
numberingFormat: config.numberingFormat | ||
}, | ||
defUnorderedListStyle: { | ||
firstLineIndent: config.firstLineIndent, | ||
leftIndent: config.listIndent, | ||
tabOffset: config.tabOffset, | ||
bulletCharCode: config.bulletChar ? config.bulletChar.charCodeAt(0) : null | ||
}, | ||
styleNameKey: "", | ||
styleNamePrefix: "" | ||
} : null; | ||
}; | ||
TextEditorController.prototype.redrawText = function () { | ||
@@ -917,5 +901,6 @@ this._redrawText(); | ||
}; | ||
TextEditorController.prototype._updateText = function (trigger) { | ||
TextEditorController.prototype._updateText = function (trigger, force) { | ||
if (force === void 0) { force = false; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var toCheckTextChanged, itemText, currentText, isTextActual, waitUpdatePromise, framesData, wrappingPathData, e_1, previewScale, textRectangle; | ||
var toCheckTextChanged, itemText, currentText, isTextActual, waitUpdatePromise, framesData, wrappingPathData, e_1, previewScale, textRectangle, updateFromTextEdit; | ||
return __generator(this, function (_a) { | ||
@@ -926,3 +911,3 @@ switch (_a.label) { | ||
return [2 /*return*/]; | ||
toCheckTextChanged = !this.isMobile && trigger === UpdateTextTriggerType.Text; | ||
toCheckTextChanged = !this.isMobile && trigger === UpdateTextTriggerType.Text && !force; | ||
if (toCheckTextChanged) { | ||
@@ -989,3 +974,4 @@ itemText = this._itemHandler.item.text; | ||
textRectangle = this._tw.textMeasurer.measureText(previewScale, false); | ||
this._itemHandler.updateRectangle(textRectangle); | ||
updateFromTextEdit = trigger === UpdateTextTriggerType.Text; | ||
this._itemHandler.updateRectangle(textRectangle, updateFromTextEdit); | ||
this._redrawText(); | ||
@@ -992,0 +978,0 @@ if (!this.isMobile) return [3 /*break*/, 12]; |
@@ -54,5 +54,4 @@ import { RectangleF } from "@aurigma/design-atoms-model/Math"; | ||
update(customText?: string): Promise<void>; | ||
private _getColorPalette; | ||
static getDefaultInlineStyle(item: BaseTextItem, colorPreviewService: IColorPreviewService): Promise<ICharStyle>; | ||
static getDefaultParagraphStyle(item: BaseTextItem): IParagraphStyle; | ||
} |
@@ -42,2 +42,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { NewBoundedTextItemHandler, NewCurvedTextItemHandler, NewPlainTextItemHandler } from "../ItemHandlers"; | ||
import { ItemUtils } from "../Utils/ItemUtils"; | ||
/** | ||
@@ -180,5 +181,5 @@ * Data required to initialize the text engine wrapper. | ||
return __awaiter(this, void 0, void 0, function () { | ||
var item, itemHandler, isTextBounded, isTextCurved, isTextPlain, _a, _b, isTextVertical, overflowStrategy, verticalAlignment, firstBaselineOffset, firstBaselineMinOffset, isFitToPath, start, end, boundedTextItem, curvedTextItem, plainTextItem; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
var item, itemHandler, isTextBounded, isTextCurved, isTextPlain, _a, _b, _c, isTextVertical, overflowStrategy, verticalAlignment, firstBaselineOffset, firstBaselineMinOffset, isFitToPath, start, end, boundedTextItem, curvedTextItem, plainTextItem; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -196,10 +197,11 @@ item = this._itemHandler.item; | ||
_a = this; | ||
return [4 /*yield*/, this._getColorPalette(itemHandler)]; | ||
_b = Collection.bind; | ||
return [4 /*yield*/, ItemUtils.getColorPalette(item, this._colorPreviewService)]; | ||
case 1: | ||
_a._colorPalette = _c.sent(); | ||
_a._colorPalette = new (_b.apply(Collection, [void 0, _d.sent()]))(); | ||
this._colorPalette.add_itemAdded(function (data) { return itemHandler.item.colorPalette.add(data.item.color); }); | ||
_b = this; | ||
_c = this; | ||
return [4 /*yield*/, TextWhizzInitData.getDefaultInlineStyle(item, this._colorPreviewService)]; | ||
case 2: | ||
_b._defaultCharStyle = _c.sent(); | ||
_c._defaultCharStyle = _d.sent(); | ||
this._defaultParagraphStyle = TextWhizzInitData.getDefaultParagraphStyle(item); | ||
@@ -246,31 +248,2 @@ this._isTextBounded = isTextBounded; | ||
}; | ||
TextWhizzInitData.prototype._getColorPalette = function (itemHandler) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var promises, colorPalette; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
promises = itemHandler.item.colorPalette.select(function (color) { return __awaiter(_this, void 0, void 0, function () { | ||
var _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = { | ||
color: color | ||
}; | ||
return [4 /*yield*/, this._colorPreviewService.getPreviewAsync(color)]; | ||
case 1: return [2 /*return*/, (_a.preview = _b.sent(), | ||
_a)]; | ||
} | ||
}); | ||
}); }).toArray(); | ||
return [4 /*yield*/, Promise.all(promises)]; | ||
case 1: | ||
colorPalette = _a.sent(); | ||
return [2 /*return*/, new Collection(colorPalette)]; | ||
} | ||
}); | ||
}); | ||
}; | ||
TextWhizzInitData.getDefaultInlineStyle = function (item, colorPreviewService) { | ||
@@ -277,0 +250,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -186,3 +186,5 @@ var __extends = (this && this.__extends) || (function () { | ||
} | ||
this.item.text = textLines.join("\n"); | ||
var result = textLines.join("\n"); | ||
if (text != result) | ||
this.item.text = result; | ||
} | ||
@@ -189,0 +191,0 @@ }; |
@@ -57,3 +57,3 @@ import { RectangleF, PointF, Path, RotatedRectangleF, Transform } from "@aurigma/design-atoms-model/Math"; | ||
setRectangle(rectangle: RotatedRectangleF, supressOnChanged?: boolean): void; | ||
updateRectangle(rectangle: RectangleF): void; | ||
updateRectangle(rectangle: RectangleF, updateFromTextEdit: boolean): void; | ||
redrawActiveText(): void; | ||
@@ -60,0 +60,0 @@ drawItemHandler(itemHandlerCtx: CanvasRenderingContext2D): void; |
@@ -393,3 +393,3 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
NewBaseTextItemHandler.prototype.updateRectangle = function (rectangle) { | ||
NewBaseTextItemHandler.prototype.updateRectangle = function (rectangle, updateFromTextEdit) { | ||
var changed = false; | ||
@@ -426,5 +426,4 @@ this._modifyItem(function (i) { | ||
var _a, _b; | ||
if (itemHandlerCtx == null || this.canvas == null || this._textWhizz == null) { | ||
if (itemHandlerCtx == null || this.canvas == null || this._textWhizz == null) | ||
return; | ||
} | ||
if (!this._isReadyToDraw) { | ||
@@ -435,4 +434,2 @@ this.canvas.drawWaitClock(itemHandlerCtx, this.rectangle.center); | ||
var renderForEyeDropper = this.ready && !((_a = this._textEditorController) === null || _a === void 0 ? void 0 : _a.isStatic) && this.canvas.isSelectionLocked(); | ||
if (this._isMobileTextEditorActive && !renderForEyeDropper) | ||
return; | ||
if (this._hasVectorMask() && !renderForEyeDropper) { | ||
@@ -442,13 +439,15 @@ itemHandlerCtx.save(); | ||
} | ||
var opacityMultiplier = this.isEmptyTextPlaceholder() ? 0.5 : 1; | ||
this.renderFill(itemHandlerCtx, opacityMultiplier); | ||
if (!this.ready || ((_b = this._textEditorController) === null || _b === void 0 ? void 0 : _b.isStatic) || renderForEyeDropper) { | ||
try { | ||
TextRenderer.renderTextImage(this, this._imageContainer, null, itemHandlerCtx, opacityMultiplier, TextRenderer.staticCanvasMargin); | ||
if (!this._isMobileTextEditorActive || renderForEyeDropper) { | ||
var opacityMultiplier = this.isEmptyTextPlaceholder() ? 0.5 : 1; | ||
this.renderFill(itemHandlerCtx, opacityMultiplier); | ||
if (!this.ready || ((_b = this._textEditorController) === null || _b === void 0 ? void 0 : _b.isStatic) || renderForEyeDropper) { | ||
try { | ||
TextRenderer.renderTextImage(this, this._imageContainer, null, itemHandlerCtx, opacityMultiplier, TextRenderer.staticCanvasMargin); | ||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
this.renderStroke(itemHandlerCtx, opacityMultiplier); | ||
} | ||
this.renderStroke(itemHandlerCtx, opacityMultiplier); | ||
if (this._hasVectorMask() && !renderForEyeDropper) | ||
@@ -554,2 +553,3 @@ itemHandlerCtx.restore(); | ||
case "text": | ||
this.textEditorController.initialize(); | ||
this.update(null, null, "text"); | ||
@@ -556,0 +556,0 @@ break; |
import { CurvedTextItem, BaseTextItem } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { NewBaseTextItemHandler } from "./NewBaseTextItemHandler"; | ||
import { Transform, PointF } from "@aurigma/design-atoms-model/Math"; | ||
import { Transform, PointF, RectangleF } from "@aurigma/design-atoms-model/Math"; | ||
import * as TextWhizz from "@aurigma/text-whizz/TextWhizzJS"; | ||
@@ -22,2 +22,3 @@ import { ITextFrameData, IWrappingPathData } from "@aurigma/design-atoms-text/TextEditor/Interfaces"; | ||
private _createTextWhizzFrame; | ||
updateRectangle(rectangle: RectangleF, updateFromTextEdit: boolean): Promise<void>; | ||
} |
@@ -14,7 +14,44 @@ var __extends = (this && this.__extends) || (function () { | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
import { CurvedTextItem } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { NewBaseTextItemHandler } from "./NewBaseTextItemHandler"; | ||
import { EqualsOfFloatNumbers } from "@aurigma/design-atoms-model/Math"; | ||
import { EqualsOfFloatNumbers, RotatedRectangleF } from "@aurigma/design-atoms-model/Math"; | ||
import { TextFrameType } from "@aurigma/design-atoms-text/TextEditor/Enums/TextFrameType"; | ||
import { toTextWhizzPath } from "@aurigma/design-atoms-text/Utils/PathUtils"; | ||
import { rectangleEquals } from "../Utils/Math"; | ||
var NewCurvedTextItemHandler = /** @class */ (function (_super) { | ||
@@ -105,2 +142,36 @@ __extends(NewCurvedTextItemHandler, _super); | ||
}; | ||
NewCurvedTextItemHandler.prototype.updateRectangle = function (rectangle, updateFromTextEdit) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var inRect, textRect, angle, oldCenter, newCenter, oldPath, rectangleChanged; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!updateFromTextEdit) | ||
return [2 /*return*/, _super.prototype.updateRectangle.call(this, rectangle, updateFromTextEdit)]; | ||
inRect = rectangle.clone(); | ||
textRect = RotatedRectangleF.fromRectangleF(rectangle); | ||
angle = this.item.transform.angle; | ||
oldCenter = this.rectangle.center; | ||
newCenter = rectangle.clone().center; | ||
oldPath = this.item.textPath.clone(); | ||
oldPath.rotateAt(angle, oldCenter); | ||
textRect.rotateAt(angle, oldCenter); | ||
newCenter.rotateAt(this.item.transform.angle, oldCenter); | ||
oldPath.rotateAt(-angle, newCenter); | ||
textRect.rotateAt(-angle, newCenter); | ||
this.item.setTextPath(oldPath, true); | ||
rectangle = textRect.toRectangleF(); | ||
_super.prototype.updateRectangle.call(this, rectangle, updateFromTextEdit); | ||
rectangleChanged = !rectangleEquals(inRect, rectangle); | ||
if (!(rectangleChanged && this.textEditor == null)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.textEditorController.waitUpdate()]; | ||
case 1: | ||
_a.sent(); | ||
this.textEditorController.updateText("text", true); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
NewCurvedTextItemHandler.typeName = "NewCurvedTextItemHandler"; | ||
@@ -107,0 +178,0 @@ return NewCurvedTextItemHandler; |
import { PlainTextItem, BaseTextItem } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { NewBaseTextItemHandler } from "./NewBaseTextItemHandler"; | ||
import { Transform, PointF } from "@aurigma/design-atoms-model/Math"; | ||
import { Transform, PointF, RectangleF } from "@aurigma/design-atoms-model/Math"; | ||
import * as TextWhizz from "@aurigma/text-whizz/TextWhizzJS"; | ||
@@ -28,2 +28,3 @@ import { IPermissions } from "../Permission"; | ||
private _createTextWhizzFrame; | ||
updateRectangle(rectangle: RectangleF, updateFromTextEdit: boolean): Promise<void>; | ||
} |
@@ -14,6 +14,43 @@ var __extends = (this && this.__extends) || (function () { | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
import { PlainTextItem } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { NewBaseTextItemHandler } from "./NewBaseTextItemHandler"; | ||
import { EqualsOfFloatNumbers } from "@aurigma/design-atoms-model/Math"; | ||
import { EqualsOfFloatNumbers, RotatedRectangleF } from "@aurigma/design-atoms-model/Math"; | ||
import { TextFrameType } from "@aurigma/design-atoms-text/TextEditor/Enums/TextFrameType"; | ||
import { rectangleEquals } from "../Utils/Math"; | ||
var NewPlainTextItemHandler = /** @class */ (function (_super) { | ||
@@ -114,2 +151,36 @@ __extends(NewPlainTextItemHandler, _super); | ||
}; | ||
NewPlainTextItemHandler.prototype.updateRectangle = function (rectangle, updateFromTextEdit) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var inRect, textRect, angle, oldCenter, newCenter, oldBaselineLocation, rectangleChanged; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!updateFromTextEdit) | ||
return [2 /*return*/, _super.prototype.updateRectangle.call(this, rectangle, updateFromTextEdit)]; | ||
inRect = rectangle.clone(); | ||
textRect = RotatedRectangleF.fromRectangleF(rectangle); | ||
angle = this.item.transform.angle; | ||
oldCenter = this.rectangle.center; | ||
newCenter = rectangle.clone().center; | ||
oldBaselineLocation = this.item.baselineLocation.clone(); | ||
oldBaselineLocation.rotateAt(angle, oldCenter); | ||
textRect.rotateAt(angle, oldCenter); | ||
newCenter.rotateAt(this.item.transform.angle, oldCenter); | ||
oldBaselineLocation.rotateAt(-angle, newCenter); | ||
textRect.rotateAt(-angle, newCenter); | ||
this.item.setBaselineLocation(oldBaselineLocation, true); | ||
rectangle = textRect.toRectangleF(); | ||
_super.prototype.updateRectangle.call(this, rectangle, updateFromTextEdit); | ||
rectangleChanged = !rectangleEquals(inRect, rectangle); | ||
if (!(rectangleChanged && this.textEditor == null)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.textEditorController.waitUpdate()]; | ||
case 1: | ||
_a.sent(); | ||
this.textEditorController.updateText("text", true); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
NewPlainTextItemHandler.typeName = "NewPlainTextItemHandler"; | ||
@@ -116,0 +187,0 @@ return NewPlainTextItemHandler; |
{ | ||
"version": "6.23.9", | ||
"version": "6.23.10", | ||
"name": "@aurigma/design-atoms", | ||
@@ -22,4 +22,4 @@ "license": "SEE LICENSE IN License.md", | ||
"dependencies": { | ||
"@aurigma/design-atoms-model": "6.6.6", | ||
"@aurigma/design-atoms-text": "6.23.9", | ||
"@aurigma/design-atoms-model": "6.6.7", | ||
"@aurigma/design-atoms-text": "6.23.10", | ||
"@aurigma/text-whizz": "1.6.31", | ||
@@ -26,0 +26,0 @@ "clone": "2.1.1", |
@@ -23,1 +23,3 @@ export * from './FloatingToolbar'; | ||
export * from './ColorPreviewService'; | ||
export * from './IListsHandler'; | ||
export * from './ListsHandler'; |
@@ -20,2 +20,3 @@ export * from './FloatingToolbar'; | ||
export * from './ColorPreviewService'; | ||
export * from './ListsHandler'; | ||
//# sourceMappingURL=index.js.map |
@@ -11,2 +11,3 @@ import { Item, BarcodeFormat, Size } from "@aurigma/design-atoms-model/Product/Items"; | ||
private readonly _colorParser; | ||
private readonly _listStyleSheetManagerFactory; | ||
constructor(_productHandler: ProductHandler, _canvas: Canvas, _productThemeManager: ProductThemeManager); | ||
@@ -31,2 +32,23 @@ applyToItem(item: Item, data: IItemData, params?: IApplyParams): Promise<boolean>; | ||
private _applyToBaseTextItem; | ||
private _removeInlineStyleFromText; | ||
private _removeParagraphStyleFromText; | ||
private _editText; | ||
private _removeColorFromText; | ||
private _removeFontNameFromText; | ||
private _removeFontSizeFromText; | ||
private _removeBoldFromText; | ||
private _removeItalicFromText; | ||
private _removeUnderlineFromText; | ||
private _removeLeadingFromText; | ||
private _removeTrackingFromText; | ||
private _removePenColorFromText; | ||
private _removePenWidthFromText; | ||
private _removeAlignmentFromText; | ||
private _removeFirstLineIndentFromText; | ||
private _removeLeftIndentFromText; | ||
private _removeRightIndentFromText; | ||
private _removeSpaceAfterFromText; | ||
private _removeSpaceBeforeFromText; | ||
private _editSpanStyles; | ||
private _editParagraphStyles; | ||
private _applyToItem; | ||
@@ -49,2 +71,3 @@ private _applyPositionAndSize; | ||
relativeToPrintArea?: boolean; | ||
applyPropertiesDeep?: boolean; | ||
} |
@@ -0,1 +1,3 @@ | ||
import { IListSetting } from "@aurigma/design-atoms-text/TextEditor/Interfaces"; | ||
import { IListConfiguration } from "../Viewer/Interfaces"; | ||
export declare namespace Utils { | ||
@@ -21,2 +23,3 @@ const round3: (value: any) => number; | ||
const isEventPathContainsClass: (event: any, cssClass: any) => boolean; | ||
function getListSettingFromConfig(config: IListConfiguration): IListSetting; | ||
} | ||
@@ -23,0 +26,0 @@ export declare enum Cursor { |
@@ -181,2 +181,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
function getListSettingFromConfig(config) { | ||
return config ? { | ||
maxNestingListLevel: config.maxLevel, | ||
defOrderedListLevelGap: config.levelIndent, | ||
defUnorderedListLevelGap: config.levelIndent, | ||
defOrderedListStyle: { | ||
firstLineIndent: config.firstLineIndent, | ||
leftIndent: config.listIndent, | ||
tabOffset: config.tabOffset, | ||
numberingFormat: config.numberingFormat | ||
}, | ||
defUnorderedListStyle: { | ||
firstLineIndent: config.firstLineIndent, | ||
leftIndent: config.listIndent, | ||
tabOffset: config.tabOffset, | ||
bulletCharCode: config.bulletChar ? config.bulletChar.charCodeAt(0) : null | ||
}, | ||
styleNameKey: "", | ||
styleNamePrefix: "" | ||
} : null; | ||
} | ||
Utils.getListSettingFromConfig = getListSettingFromConfig; | ||
})(Utils || (Utils = {})); | ||
@@ -183,0 +205,0 @@ export var Cursor; |
@@ -19,2 +19,4 @@ import { Item } from "@aurigma/design-atoms-model/Product/Items/Item"; | ||
import { IDesignAtomsApiClient } from "../Services/IDesignAtomsApiClient"; | ||
import { IColorData } from "@aurigma/design-atoms-text/Model"; | ||
import { IColorPreviewService } from "../Services"; | ||
export declare class ItemUtils { | ||
@@ -73,2 +75,4 @@ private static _designAtomsApiClient; | ||
static alignHandlerToRect(itemHandler: BaseRectangleItemHandler, rectangle: RotatedRectangleF, item: Item): void; | ||
static isRotated(item: Item, contentAngle: number): boolean; | ||
static getColorPalette(item: BaseTextItem, colorPreviewService: IColorPreviewService): Promise<IColorData[]>; | ||
} | ||
@@ -75,0 +79,0 @@ export declare type UpdateItemsOptions = { |
@@ -85,4 +85,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { ImageEffect } from "@aurigma/design-atoms-model/Product/Items/ImageEffect"; | ||
import { ISize, fitSizeToSize, alignRectToRect } from "./Math"; | ||
import { PointF } from "@aurigma/design-atoms-model/Math"; | ||
import { ISize, fitSizeToSize, alignRectToRect, equalsOfFloatNumbers } from "./Math"; | ||
import { PointF, normalizeAngle } from "@aurigma/design-atoms-model/Math"; | ||
import { ItemsCommand } from "../Commands/CommandManager"; | ||
@@ -818,2 +818,32 @@ import { Size } from "@aurigma/design-atoms-model/Product/Items/Size"; | ||
}; | ||
ItemUtils.isRotated = function (item, contentAngle) { | ||
return !equalsOfFloatNumbers(normalizeAngle(Math.round(item.transform.angle + contentAngle)), 0); | ||
}; | ||
ItemUtils.getColorPalette = function (item, colorPreviewService) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var promises; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
promises = item.colorPalette.select(function (color) { return __awaiter(_this, void 0, void 0, function () { | ||
var _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = { | ||
color: color | ||
}; | ||
return [4 /*yield*/, colorPreviewService.getPreviewAsync(color)]; | ||
case 1: return [2 /*return*/, (_a.preview = _b.sent(), | ||
_a)]; | ||
} | ||
}); | ||
}); }).toArray(); | ||
return [4 /*yield*/, Promise.all(promises)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
ItemUtils._designAtomsApiClient = null; | ||
@@ -820,0 +850,0 @@ ItemUtils.setOverlayEffectColor = function (item, color) { |
@@ -41,2 +41,3 @@ import { PrintArea } from "@aurigma/design-atoms-model/Product"; | ||
apiClientConfiguration: IApiClientConfiguration; | ||
rotatedTextInPlaceEditEnabled?: boolean; | ||
} |
@@ -36,2 +36,3 @@ import { PrintArea } from "@aurigma/design-atoms-model/Product"; | ||
apiClientConfiguration: IApiClientConfiguration; | ||
rotatedTextInPlaceEditEnabled?: boolean; | ||
constructor(conf: IViewerConfiguration); | ||
@@ -38,0 +39,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4493232
1038
59286
+ Added@aurigma/design-atoms-model@6.6.7(transitive)
+ Added@aurigma/design-atoms-text@6.23.10(transitive)
- Removed@aurigma/design-atoms-model@6.6.6(transitive)
- Removed@aurigma/design-atoms-text@6.23.9(transitive)