@anu3ev/fabric-image-editor 0.7.11 → 0.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +809 -442
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -258,17 +258,17 @@ function I(e, t, n, r, i) {
|
|
|
258
258
|
function ee(e, t, n, r, i) {
|
|
259
259
|
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = F, e.strokeStyle = P, e.lineWidth = 1, e.beginPath(), e.roundRect(-8 / 2, -20 / 2, 8, 20, 100), e.fill(), e.stroke(), e.restore();
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function te(e, t, n, r, i) {
|
|
262
262
|
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = F, e.strokeStyle = P, e.lineWidth = 1, e.beginPath(), e.roundRect(-20 / 2, -8 / 2, 20, 8, 100), e.fill(), e.stroke(), e.restore();
|
|
263
263
|
}
|
|
264
|
-
var
|
|
265
|
-
|
|
266
|
-
function
|
|
267
|
-
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = N, e.beginPath(), e.arc(0, 0, 16, 0, 2 * Math.PI), e.fill(), e.drawImage(
|
|
264
|
+
var L = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ne = new Image();
|
|
265
|
+
ne.src = L;
|
|
266
|
+
function re(e, t, n, r, i) {
|
|
267
|
+
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = N, e.beginPath(), e.arc(0, 0, 16, 0, 2 * Math.PI), e.fill(), e.drawImage(ne, -16 / 2, -16 / 2, 16, 16), e.restore();
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/editor/customized-controls/default-controls.ts
|
|
271
|
-
var
|
|
271
|
+
var R = {
|
|
272
272
|
tl: {
|
|
273
273
|
render: I,
|
|
274
274
|
sizeX: 12,
|
|
@@ -312,27 +312,27 @@ var z = {
|
|
|
312
312
|
offsetY: 0
|
|
313
313
|
},
|
|
314
314
|
mt: {
|
|
315
|
-
render:
|
|
315
|
+
render: te,
|
|
316
316
|
sizeX: 20,
|
|
317
317
|
sizeY: 8,
|
|
318
318
|
offsetX: 0,
|
|
319
319
|
offsetY: 0
|
|
320
320
|
},
|
|
321
321
|
mb: {
|
|
322
|
-
render:
|
|
322
|
+
render: te,
|
|
323
323
|
sizeX: 20,
|
|
324
324
|
sizeY: 8,
|
|
325
325
|
offsetX: 0,
|
|
326
326
|
offsetY: 0
|
|
327
327
|
},
|
|
328
328
|
mtr: {
|
|
329
|
-
render:
|
|
329
|
+
render: re,
|
|
330
330
|
sizeX: 32,
|
|
331
331
|
sizeY: 32,
|
|
332
332
|
offsetX: 0,
|
|
333
333
|
offsetY: -32
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, ie = class t {
|
|
336
336
|
static wrapWidthControl(e) {
|
|
337
337
|
if (!e?.actionHandler) return;
|
|
338
338
|
let t = e.actionHandler;
|
|
@@ -342,7 +342,7 @@ var z = {
|
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
344
|
static applyControlOverrides(e) {
|
|
345
|
-
Object.entries(
|
|
345
|
+
Object.entries(R).forEach(([t, n]) => {
|
|
346
346
|
let r = e[t];
|
|
347
347
|
r && (Object.assign(r, n), t === "mtr" && (r.cursorStyle = "grab", r.mouseDownHandler = (e, t, n, r) => {
|
|
348
348
|
let i = t?.target;
|
|
@@ -432,7 +432,7 @@ var z = {
|
|
|
432
432
|
mr: !0
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
},
|
|
435
|
+
}, z = class e {
|
|
436
436
|
static {
|
|
437
437
|
this.registeredFontKeys = /* @__PURE__ */ new Set();
|
|
438
438
|
}
|
|
@@ -585,7 +585,7 @@ var z = {
|
|
|
585
585
|
};
|
|
586
586
|
return Object.entries(e).filter(([, e]) => e != null && `${e}`.length > 0).map(([e, n]) => `${t[e] ?? e}: ${n};`);
|
|
587
587
|
}
|
|
588
|
-
},
|
|
588
|
+
}, B = {
|
|
589
589
|
style: {
|
|
590
590
|
position: "absolute",
|
|
591
591
|
display: "none",
|
|
@@ -687,7 +687,7 @@ var z = {
|
|
|
687
687
|
e.layerManager.sendBackwards();
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
},
|
|
690
|
+
}, V = class {
|
|
691
691
|
constructor({ editor: e }) {
|
|
692
692
|
this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this.editor = e, this.canvas = e.canvas, this.options = e.options, this._initToolbar();
|
|
693
693
|
}
|
|
@@ -695,22 +695,22 @@ var z = {
|
|
|
695
695
|
if (!this.options.showToolbar) return;
|
|
696
696
|
let e = this.options.toolbar || {};
|
|
697
697
|
this.config = {
|
|
698
|
-
...
|
|
698
|
+
...B,
|
|
699
699
|
...e,
|
|
700
700
|
style: {
|
|
701
|
-
...
|
|
701
|
+
...B.style,
|
|
702
702
|
...e.style || {}
|
|
703
703
|
},
|
|
704
704
|
btnStyle: {
|
|
705
|
-
...
|
|
705
|
+
...B.btnStyle,
|
|
706
706
|
...e.btnStyle || {}
|
|
707
707
|
},
|
|
708
708
|
icons: {
|
|
709
|
-
...
|
|
709
|
+
...B.icons,
|
|
710
710
|
...e.icons || {}
|
|
711
711
|
},
|
|
712
712
|
handlers: {
|
|
713
|
-
...
|
|
713
|
+
...B.handlers,
|
|
714
714
|
...e.handlers || {}
|
|
715
715
|
}
|
|
716
716
|
}, this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
|
|
@@ -788,7 +788,7 @@ var z = {
|
|
|
788
788
|
destroy() {
|
|
789
789
|
this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
|
|
790
790
|
}
|
|
791
|
-
},
|
|
791
|
+
}, H = {
|
|
792
792
|
position: "absolute",
|
|
793
793
|
display: "none",
|
|
794
794
|
background: "#2B2D33",
|
|
@@ -807,7 +807,7 @@ var z = {
|
|
|
807
807
|
this.isActive = !1, this.currentAngle = 0, this.editor = e, this.canvas = e.canvas, this.options = e.options, this._createDOM(), this._bindEvents();
|
|
808
808
|
}
|
|
809
809
|
_createDOM() {
|
|
810
|
-
this.el = document.createElement("div"), this.el.className = U, Object.entries(
|
|
810
|
+
this.el = document.createElement("div"), this.el.className = U, Object.entries(H).forEach(([e, t]) => {
|
|
811
811
|
this.el.style.setProperty(e, t);
|
|
812
812
|
}), this.canvas.wrapperEl.appendChild(this.el);
|
|
813
813
|
}
|
|
@@ -852,7 +852,7 @@ var z = {
|
|
|
852
852
|
destroy() {
|
|
853
853
|
this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), this.el?.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
|
|
854
854
|
}
|
|
855
|
-
}, oe = /* @__PURE__ */ "id.backgroundId.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeTextAutoExpand.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split(".");
|
|
855
|
+
}, oe = /* @__PURE__ */ "id.backgroundId.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeReplaceBoxWidth.shapeReplaceBoxHeight.shapeTextAutoExpand.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split(".");
|
|
856
856
|
//#endregion
|
|
857
857
|
//#region src/editor/history-manager/diff-normalization.ts
|
|
858
858
|
function se({ state: e }) {
|
|
@@ -1293,7 +1293,7 @@ var je = class {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
|
-
}, Me = .1, Ne = 4096, Pe = 4096, Fe = "application/image-editor:", Ie = /* @__PURE__ */ "customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeTextAutoExpand.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split("."), Le = class e {
|
|
1296
|
+
}, Me = .1, Ne = 4096, Pe = 4096, Fe = "application/image-editor:", Ie = /* @__PURE__ */ "customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeReplaceBoxWidth.shapeReplaceBoxHeight.shapeTextAutoExpand.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split("."), Le = class e {
|
|
1297
1297
|
constructor({ editor: e }) {
|
|
1298
1298
|
this.editor = e, this.options = e.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
|
|
1299
1299
|
}
|
|
@@ -2269,30 +2269,30 @@ var Ve = class {
|
|
|
2269
2269
|
point: r
|
|
2270
2270
|
}), this.editor.panConstraintManager.updateBounds();
|
|
2271
2271
|
}
|
|
2272
|
-
},
|
|
2273
|
-
let r =
|
|
2272
|
+
}, We = ({ value: e, fallback: t = 0 }) => typeof e == "number" && Number.isFinite(e) ? e : typeof t == "number" && Number.isFinite(t) ? t : 0, Ge = ({ value: e, dimension: t, useRelativePositions: n }) => {
|
|
2273
|
+
let r = We({ value: e });
|
|
2274
2274
|
return n ? r : r / (t || 1);
|
|
2275
|
-
},
|
|
2276
|
-
x:
|
|
2275
|
+
}, Ke = ({ object: e, baseWidth: t, baseHeight: n, useRelativePositions: r }) => ({
|
|
2276
|
+
x: Ge({
|
|
2277
2277
|
value: e.left,
|
|
2278
2278
|
dimension: t,
|
|
2279
2279
|
useRelativePositions: r
|
|
2280
2280
|
}),
|
|
2281
|
-
y:
|
|
2281
|
+
y: Ge({
|
|
2282
2282
|
value: e.top,
|
|
2283
2283
|
dimension: n,
|
|
2284
2284
|
useRelativePositions: r
|
|
2285
2285
|
})
|
|
2286
|
-
}),
|
|
2286
|
+
}), qe = ({ normalizedX: e, normalizedY: t, bounds: n }) => {
|
|
2287
2287
|
let { left: r, top: i, width: a, height: o } = n;
|
|
2288
2288
|
return new p(r + e * a, i + t * o);
|
|
2289
|
-
},
|
|
2289
|
+
}, Je = ({ object: e }) => {
|
|
2290
2290
|
let { left: t = 0, top: n = 0, width: r = 0, height: i = 0, scaleX: a = 1, scaleY: o = 1, strokeWidth: s = 0, strokeUniform: c = !1 } = e, l = typeof e.type == "string" ? e.type.toLowerCase() : "", u = e instanceof _ || l === "textbox" || l === "background-textbox", d = c ? 0 : s, f = r + d, p = i + d, m = {
|
|
2291
2291
|
left: Math.round(t),
|
|
2292
2292
|
top: Math.round(n)
|
|
2293
2293
|
};
|
|
2294
2294
|
u || (f > 0 && (m.scaleX = Math.max(1, Math.round(f * a)) / f), p > 0 && (m.scaleY = Math.max(1, Math.round(p * o)) / p)), e.set(m), e.setCoords();
|
|
2295
|
-
},
|
|
2295
|
+
}, Ye = ({ object: e }) => {
|
|
2296
2296
|
if (!e) return null;
|
|
2297
2297
|
try {
|
|
2298
2298
|
e.setCoords();
|
|
@@ -2311,17 +2311,17 @@ var Ve = class {
|
|
|
2311
2311
|
};
|
|
2312
2312
|
//#endregion
|
|
2313
2313
|
//#region src/editor/utils/primitive-shapes.ts
|
|
2314
|
-
function
|
|
2314
|
+
function Xe({ canvas: e, object: t, left: n, top: r, centerPoint: i, flags: a }) {
|
|
2315
2315
|
let { withoutSelection: o, withoutAdding: s } = a;
|
|
2316
2316
|
if (n === void 0 && r === void 0) {
|
|
2317
2317
|
let n = i ?? e.getCenterPoint();
|
|
2318
2318
|
t.setPositionByOrigin(n, "center", "center"), t.setCoords();
|
|
2319
2319
|
}
|
|
2320
|
-
return
|
|
2320
|
+
return Je({ object: t }), s ? t : (e.add(t), o || e.setActiveObject(t), e.renderAll(), t);
|
|
2321
2321
|
}
|
|
2322
|
-
var
|
|
2322
|
+
var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
2323
2323
|
let { id: i = `rect-${D()}`, left: a, top: o, width: s = 100, height: c = 100, fill: l = "blue", ...u } = t;
|
|
2324
|
-
return
|
|
2324
|
+
return Xe({
|
|
2325
2325
|
canvas: e,
|
|
2326
2326
|
object: new g({
|
|
2327
2327
|
id: i,
|
|
@@ -2337,7 +2337,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2337
2337
|
centerPoint: n,
|
|
2338
2338
|
flags: r
|
|
2339
2339
|
});
|
|
2340
|
-
},
|
|
2340
|
+
}, Qe = class {
|
|
2341
2341
|
constructor({ editor: e }) {
|
|
2342
2342
|
this.editor = e, this.isBlocked = !1, this.overlayMask = null;
|
|
2343
2343
|
}
|
|
@@ -2359,7 +2359,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2359
2359
|
}
|
|
2360
2360
|
_createOverlay() {
|
|
2361
2361
|
let { historyManager: e, options: { overlayMaskColor: t = "rgba(0,0,0,0.5)" } } = this.editor;
|
|
2362
|
-
e.suspendHistory(), this.overlayMask =
|
|
2362
|
+
e.suspendHistory(), this.overlayMask = Ze({
|
|
2363
2363
|
canvas: this.editor.canvas,
|
|
2364
2364
|
options: {
|
|
2365
2365
|
...this._getOverlayGeometry(),
|
|
@@ -2397,7 +2397,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2397
2397
|
e.evented = !0, e.selectable = !0;
|
|
2398
2398
|
}), e.upperCanvasEl.style.pointerEvents = "", e.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, e.requestRenderAll(), e.fire("editor:enabled"), n.resumeHistory(), n.flushDeferredSaveAfterUnblock();
|
|
2399
2399
|
}
|
|
2400
|
-
},
|
|
2400
|
+
}, $e = class e {
|
|
2401
2401
|
constructor({ editor: e }) {
|
|
2402
2402
|
this.editor = e, this.backgroundObject = null;
|
|
2403
2403
|
}
|
|
@@ -2589,7 +2589,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2589
2589
|
this.backgroundObject && a !== i + 1 && e.moveObjectTo(this.backgroundObject, i + 1), e.requestRenderAll(), n.resumeHistory();
|
|
2590
2590
|
}
|
|
2591
2591
|
_createColorBackground(e) {
|
|
2592
|
-
this.backgroundObject =
|
|
2592
|
+
this.backgroundObject = Ze({
|
|
2593
2593
|
canvas: this.editor.canvas,
|
|
2594
2594
|
options: {
|
|
2595
2595
|
...this._getMontageBackgroundRectOptions(),
|
|
@@ -2606,7 +2606,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2606
2606
|
}), this.refresh();
|
|
2607
2607
|
}
|
|
2608
2608
|
_createGradientBackground(t) {
|
|
2609
|
-
this.backgroundObject =
|
|
2609
|
+
this.backgroundObject = Ze({
|
|
2610
2610
|
canvas: this.editor.canvas,
|
|
2611
2611
|
options: {
|
|
2612
2612
|
...this._getMontageBackgroundRectOptions(),
|
|
@@ -2705,7 +2705,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2705
2705
|
return e.color === n.color && Math.abs(e.offset - n.offset) < 1e-4;
|
|
2706
2706
|
}) ? !1 : e.type === "linear" && t.type === "linear" ? Math.abs(e.coords.x1 - t.coords.x1) < 1e-4 && Math.abs(e.coords.y1 - t.coords.y1) < 1e-4 && Math.abs(e.coords.x2 - t.coords.x2) < 1e-4 && Math.abs(e.coords.y2 - t.coords.y2) < 1e-4 : e.type === "radial" && t.type === "radial" ? Math.abs(e.coords.x1 - t.coords.x1) < 1e-4 && Math.abs(e.coords.y1 - t.coords.y1) < 1e-4 && Math.abs(e.coords.x2 - t.coords.x2) < 1e-4 && Math.abs(e.coords.y2 - t.coords.y2) < 1e-4 && Math.abs(e.coords.r1 - t.coords.r1) < 1e-4 && Math.abs(e.coords.r2 - t.coords.r2) < 1e-4 : !1;
|
|
2707
2707
|
}
|
|
2708
|
-
},
|
|
2708
|
+
}, et = class t {
|
|
2709
2709
|
constructor({ editor: e }) {
|
|
2710
2710
|
this.editor = e;
|
|
2711
2711
|
}
|
|
@@ -2779,28 +2779,24 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2779
2779
|
e.sendObjectBackwards(t.obj);
|
|
2780
2780
|
});
|
|
2781
2781
|
}
|
|
2782
|
-
},
|
|
2782
|
+
}, W = 180, tt = {
|
|
2783
2783
|
top: 0,
|
|
2784
2784
|
right: 0,
|
|
2785
2785
|
bottom: 0,
|
|
2786
2786
|
left: 0
|
|
2787
|
-
},
|
|
2788
|
-
let
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
y: nt({ value: r + t * Math.sin(s) })
|
|
2794
|
-
});
|
|
2795
|
-
}
|
|
2796
|
-
return a;
|
|
2787
|
+
}, nt = .45, rt = ({ value: e }) => Number(e.toFixed(4)), G = ({ width: e, height: t }) => {
|
|
2788
|
+
let n = W / Math.max(e, t);
|
|
2789
|
+
return {
|
|
2790
|
+
width: rt({ value: e * n }),
|
|
2791
|
+
height: rt({ value: t * n })
|
|
2792
|
+
};
|
|
2797
2793
|
}, it = ({ spikes: e, outerRadius: t = 50, innerRadius: n = 22, centerX: r = 50, centerY: i = 50, rotation: a = -Math.PI / 2 }) => {
|
|
2798
2794
|
let o = [], s = e * 2;
|
|
2799
2795
|
for (let c = 0; c < s; c += 1) {
|
|
2800
2796
|
let s = c % 2 == 0 ? t : n, l = a + c * Math.PI / e;
|
|
2801
2797
|
o.push({
|
|
2802
|
-
x:
|
|
2803
|
-
y:
|
|
2798
|
+
x: rt({ value: r + s * Math.cos(l) }),
|
|
2799
|
+
y: rt({ value: i + s * Math.sin(l) })
|
|
2804
2800
|
});
|
|
2805
2801
|
}
|
|
2806
2802
|
return o;
|
|
@@ -2808,8 +2804,8 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2808
2804
|
{
|
|
2809
2805
|
key: "circle",
|
|
2810
2806
|
type: "ellipse",
|
|
2811
|
-
width:
|
|
2812
|
-
height:
|
|
2807
|
+
width: W,
|
|
2808
|
+
height: W,
|
|
2813
2809
|
internalTextInset: {
|
|
2814
2810
|
top: .24,
|
|
2815
2811
|
right: .24,
|
|
@@ -2817,29 +2813,46 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2817
2813
|
left: .24
|
|
2818
2814
|
}
|
|
2819
2815
|
},
|
|
2816
|
+
{
|
|
2817
|
+
key: "pie",
|
|
2818
|
+
type: "path",
|
|
2819
|
+
...G({
|
|
2820
|
+
width: 34,
|
|
2821
|
+
height: 34
|
|
2822
|
+
}),
|
|
2823
|
+
path: "M34 17A17 17 0 1 1 17 0v17z",
|
|
2824
|
+
internalTextInset: {
|
|
2825
|
+
top: .22,
|
|
2826
|
+
right: .26,
|
|
2827
|
+
bottom: .14,
|
|
2828
|
+
left: .14
|
|
2829
|
+
}
|
|
2830
|
+
},
|
|
2820
2831
|
{
|
|
2821
2832
|
key: "triangle",
|
|
2822
2833
|
type: "triangle",
|
|
2823
|
-
|
|
2824
|
-
|
|
2834
|
+
...G({
|
|
2835
|
+
width: 38,
|
|
2836
|
+
height: 31
|
|
2837
|
+
}),
|
|
2825
2838
|
internalTextInset: {
|
|
2826
|
-
top: .
|
|
2827
|
-
right: .
|
|
2828
|
-
bottom: .
|
|
2829
|
-
left: .
|
|
2839
|
+
top: .34,
|
|
2840
|
+
right: .18,
|
|
2841
|
+
bottom: .12,
|
|
2842
|
+
left: .18
|
|
2830
2843
|
}
|
|
2831
2844
|
},
|
|
2832
2845
|
{
|
|
2833
2846
|
key: "square",
|
|
2834
2847
|
type: "rect",
|
|
2835
|
-
width:
|
|
2836
|
-
height:
|
|
2848
|
+
width: W,
|
|
2849
|
+
height: W
|
|
2837
2850
|
},
|
|
2838
2851
|
{
|
|
2839
2852
|
key: "diamond",
|
|
2840
2853
|
type: "polygon",
|
|
2841
|
-
width:
|
|
2842
|
-
height:
|
|
2854
|
+
width: W,
|
|
2855
|
+
height: W,
|
|
2843
2856
|
points: [
|
|
2844
2857
|
{
|
|
2845
2858
|
x: 50,
|
|
@@ -2868,95 +2881,194 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2868
2881
|
{
|
|
2869
2882
|
key: "pentagon",
|
|
2870
2883
|
type: "polygon",
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
sides: 5,
|
|
2875
|
-
radius: 50,
|
|
2876
|
-
rotation: -Math.PI / 2
|
|
2884
|
+
...G({
|
|
2885
|
+
width: 36,
|
|
2886
|
+
height: 33
|
|
2877
2887
|
}),
|
|
2888
|
+
points: [
|
|
2889
|
+
{
|
|
2890
|
+
x: 50,
|
|
2891
|
+
y: 0
|
|
2892
|
+
},
|
|
2893
|
+
{
|
|
2894
|
+
x: 100,
|
|
2895
|
+
y: 38.197
|
|
2896
|
+
},
|
|
2897
|
+
{
|
|
2898
|
+
x: 80.9028,
|
|
2899
|
+
y: 100
|
|
2900
|
+
},
|
|
2901
|
+
{
|
|
2902
|
+
x: 19.0972,
|
|
2903
|
+
y: 100
|
|
2904
|
+
},
|
|
2905
|
+
{
|
|
2906
|
+
x: 0,
|
|
2907
|
+
y: 38.197
|
|
2908
|
+
}
|
|
2909
|
+
],
|
|
2878
2910
|
internalTextInset: {
|
|
2879
|
-
top: .
|
|
2880
|
-
right: .
|
|
2881
|
-
bottom: .
|
|
2882
|
-
left: .
|
|
2911
|
+
top: .24,
|
|
2912
|
+
right: .18,
|
|
2913
|
+
bottom: .18,
|
|
2914
|
+
left: .18
|
|
2883
2915
|
}
|
|
2884
2916
|
},
|
|
2885
2917
|
{
|
|
2886
2918
|
key: "hexagon",
|
|
2887
2919
|
type: "polygon",
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
sides: 6,
|
|
2892
|
-
radius: 50,
|
|
2893
|
-
rotation: 0
|
|
2920
|
+
...G({
|
|
2921
|
+
width: 32,
|
|
2922
|
+
height: 36
|
|
2894
2923
|
}),
|
|
2924
|
+
points: [
|
|
2925
|
+
{
|
|
2926
|
+
x: 50,
|
|
2927
|
+
y: 0
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
x: 100,
|
|
2931
|
+
y: 25
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
x: 100,
|
|
2935
|
+
y: 75
|
|
2936
|
+
},
|
|
2937
|
+
{
|
|
2938
|
+
x: 50,
|
|
2939
|
+
y: 100
|
|
2940
|
+
},
|
|
2941
|
+
{
|
|
2942
|
+
x: 0,
|
|
2943
|
+
y: 75
|
|
2944
|
+
},
|
|
2945
|
+
{
|
|
2946
|
+
x: 0,
|
|
2947
|
+
y: 25
|
|
2948
|
+
}
|
|
2949
|
+
],
|
|
2895
2950
|
internalTextInset: {
|
|
2896
|
-
top: .
|
|
2897
|
-
right: .
|
|
2898
|
-
bottom: .
|
|
2899
|
-
left: .
|
|
2951
|
+
top: .22,
|
|
2952
|
+
right: .18,
|
|
2953
|
+
bottom: .22,
|
|
2954
|
+
left: .18
|
|
2900
2955
|
}
|
|
2901
2956
|
},
|
|
2902
2957
|
{
|
|
2903
2958
|
key: "star",
|
|
2904
2959
|
type: "polygon",
|
|
2905
|
-
|
|
2906
|
-
|
|
2960
|
+
...G({
|
|
2961
|
+
width: 38,
|
|
2962
|
+
height: 36
|
|
2963
|
+
}),
|
|
2964
|
+
points: [
|
|
2965
|
+
{
|
|
2966
|
+
x: 50,
|
|
2967
|
+
y: 0
|
|
2968
|
+
},
|
|
2969
|
+
{
|
|
2970
|
+
x: 61.8026,
|
|
2971
|
+
y: 38.1944
|
|
2972
|
+
},
|
|
2973
|
+
{
|
|
2974
|
+
x: 100,
|
|
2975
|
+
y: 38.1944
|
|
2976
|
+
},
|
|
2977
|
+
{
|
|
2978
|
+
x: 69.0974,
|
|
2979
|
+
y: 61.8056
|
|
2980
|
+
},
|
|
2981
|
+
{
|
|
2982
|
+
x: 80.9026,
|
|
2983
|
+
y: 100
|
|
2984
|
+
},
|
|
2985
|
+
{
|
|
2986
|
+
x: 50,
|
|
2987
|
+
y: 76.3944
|
|
2988
|
+
},
|
|
2989
|
+
{
|
|
2990
|
+
x: 19.0974,
|
|
2991
|
+
y: 100
|
|
2992
|
+
},
|
|
2993
|
+
{
|
|
2994
|
+
x: 30.9026,
|
|
2995
|
+
y: 61.8056
|
|
2996
|
+
},
|
|
2997
|
+
{
|
|
2998
|
+
x: 0,
|
|
2999
|
+
y: 38.1944
|
|
3000
|
+
},
|
|
3001
|
+
{
|
|
3002
|
+
x: 38.1974,
|
|
3003
|
+
y: 38.1944
|
|
3004
|
+
}
|
|
3005
|
+
],
|
|
3006
|
+
internalTextInset: {
|
|
3007
|
+
top: .3,
|
|
3008
|
+
right: .3,
|
|
3009
|
+
bottom: .3,
|
|
3010
|
+
left: .3
|
|
3011
|
+
}
|
|
3012
|
+
},
|
|
3013
|
+
{
|
|
3014
|
+
key: "star-16",
|
|
3015
|
+
type: "polygon",
|
|
3016
|
+
width: W,
|
|
3017
|
+
height: W,
|
|
2907
3018
|
points: it({
|
|
2908
|
-
spikes:
|
|
3019
|
+
spikes: 16,
|
|
2909
3020
|
outerRadius: 50,
|
|
2910
|
-
innerRadius:
|
|
3021
|
+
innerRadius: 45,
|
|
2911
3022
|
rotation: -Math.PI / 2
|
|
2912
3023
|
}),
|
|
2913
3024
|
internalTextInset: {
|
|
2914
|
-
top: .
|
|
2915
|
-
right: .
|
|
2916
|
-
bottom: .
|
|
2917
|
-
left: .
|
|
3025
|
+
top: .24,
|
|
3026
|
+
right: .24,
|
|
3027
|
+
bottom: .24,
|
|
3028
|
+
left: .24
|
|
2918
3029
|
}
|
|
2919
3030
|
},
|
|
2920
3031
|
{
|
|
2921
3032
|
key: "sparkle",
|
|
2922
3033
|
type: "polygon",
|
|
2923
|
-
width:
|
|
2924
|
-
height:
|
|
3034
|
+
width: W,
|
|
3035
|
+
height: W,
|
|
2925
3036
|
points: it({
|
|
2926
3037
|
spikes: 4,
|
|
2927
3038
|
outerRadius: 50,
|
|
2928
|
-
innerRadius:
|
|
3039
|
+
innerRadius: 19.1,
|
|
2929
3040
|
rotation: -Math.PI / 2
|
|
2930
3041
|
}),
|
|
2931
3042
|
internalTextInset: {
|
|
2932
|
-
top: .
|
|
2933
|
-
right: .
|
|
2934
|
-
bottom: .
|
|
2935
|
-
left: .
|
|
3043
|
+
top: .32,
|
|
3044
|
+
right: .32,
|
|
3045
|
+
bottom: .32,
|
|
3046
|
+
left: .32
|
|
2936
3047
|
}
|
|
2937
3048
|
},
|
|
2938
3049
|
{
|
|
2939
3050
|
key: "heart",
|
|
2940
3051
|
type: "path",
|
|
2941
|
-
|
|
2942
|
-
|
|
3052
|
+
...G({
|
|
3053
|
+
width: 36,
|
|
3054
|
+
height: 34
|
|
3055
|
+
}),
|
|
2943
3056
|
path: [
|
|
2944
|
-
"
|
|
2945
|
-
"
|
|
2946
|
-
"
|
|
2947
|
-
"C96 56 80 74 50 92 Z"
|
|
3057
|
+
"M26 0c5.523 0 10 4.477 10 10l-.013.586",
|
|
3058
|
+
"C35.443 22.876 18.003 33.998 18 34c-.004-.003-18-11.48-18-24",
|
|
3059
|
+
"C0 4.477 4.477 0 10 0a9.99 9.99 0 0 1 8 3.999A9.99 9.99 0 0 1 26 0"
|
|
2948
3060
|
].join(" "),
|
|
2949
3061
|
internalTextInset: {
|
|
2950
|
-
top: .
|
|
2951
|
-
right: .
|
|
2952
|
-
bottom: .
|
|
2953
|
-
left: .
|
|
3062
|
+
top: .22,
|
|
3063
|
+
right: .22,
|
|
3064
|
+
bottom: .16,
|
|
3065
|
+
left: .22
|
|
2954
3066
|
}
|
|
2955
3067
|
},
|
|
2956
3068
|
{
|
|
2957
3069
|
key: "arrow-right-fat",
|
|
2958
3070
|
type: "polygon",
|
|
2959
|
-
width:
|
|
3071
|
+
width: W,
|
|
2960
3072
|
height: 130,
|
|
2961
3073
|
points: [
|
|
2962
3074
|
{
|
|
@@ -2999,7 +3111,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2999
3111
|
key: "arrow-up-fat",
|
|
3000
3112
|
type: "polygon",
|
|
3001
3113
|
width: 130,
|
|
3002
|
-
height:
|
|
3114
|
+
height: W,
|
|
3003
3115
|
points: [
|
|
3004
3116
|
{
|
|
3005
3117
|
x: 38,
|
|
@@ -3040,50 +3152,140 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3040
3152
|
{
|
|
3041
3153
|
key: "arrow-right",
|
|
3042
3154
|
type: "polygon",
|
|
3043
|
-
|
|
3044
|
-
|
|
3155
|
+
...G({
|
|
3156
|
+
width: 36,
|
|
3157
|
+
height: 28
|
|
3158
|
+
}),
|
|
3045
3159
|
points: [
|
|
3160
|
+
{
|
|
3161
|
+
x: 100,
|
|
3162
|
+
y: 50
|
|
3163
|
+
},
|
|
3164
|
+
{
|
|
3165
|
+
x: 61.1111,
|
|
3166
|
+
y: 100
|
|
3167
|
+
},
|
|
3168
|
+
{
|
|
3169
|
+
x: 61.1111,
|
|
3170
|
+
y: 71.4286
|
|
3171
|
+
},
|
|
3046
3172
|
{
|
|
3047
3173
|
x: 0,
|
|
3048
|
-
y:
|
|
3174
|
+
y: 71.4286
|
|
3049
3175
|
},
|
|
3050
3176
|
{
|
|
3051
|
-
x:
|
|
3052
|
-
y:
|
|
3177
|
+
x: 0,
|
|
3178
|
+
y: 28.5714
|
|
3179
|
+
},
|
|
3180
|
+
{
|
|
3181
|
+
x: 61.1111,
|
|
3182
|
+
y: 28.5714
|
|
3183
|
+
},
|
|
3184
|
+
{
|
|
3185
|
+
x: 61.1111,
|
|
3186
|
+
y: 0
|
|
3187
|
+
}
|
|
3188
|
+
],
|
|
3189
|
+
internalTextInset: {
|
|
3190
|
+
top: .2,
|
|
3191
|
+
right: .38,
|
|
3192
|
+
bottom: .2,
|
|
3193
|
+
left: .1
|
|
3194
|
+
}
|
|
3195
|
+
},
|
|
3196
|
+
{
|
|
3197
|
+
key: "arrow-left",
|
|
3198
|
+
type: "polygon",
|
|
3199
|
+
...G({
|
|
3200
|
+
width: 36,
|
|
3201
|
+
height: 28
|
|
3202
|
+
}),
|
|
3203
|
+
points: [
|
|
3204
|
+
{
|
|
3205
|
+
x: 38.8889,
|
|
3206
|
+
y: 28.5714
|
|
3053
3207
|
},
|
|
3054
3208
|
{
|
|
3055
|
-
x:
|
|
3056
|
-
y:
|
|
3209
|
+
x: 100,
|
|
3210
|
+
y: 28.5714
|
|
3057
3211
|
},
|
|
3058
3212
|
{
|
|
3059
3213
|
x: 100,
|
|
3214
|
+
y: 71.4286
|
|
3215
|
+
},
|
|
3216
|
+
{
|
|
3217
|
+
x: 38.8889,
|
|
3218
|
+
y: 71.4286
|
|
3219
|
+
},
|
|
3220
|
+
{
|
|
3221
|
+
x: 38.8889,
|
|
3222
|
+
y: 100
|
|
3223
|
+
},
|
|
3224
|
+
{
|
|
3225
|
+
x: 0,
|
|
3060
3226
|
y: 50
|
|
3061
3227
|
},
|
|
3062
3228
|
{
|
|
3063
|
-
x:
|
|
3064
|
-
y:
|
|
3229
|
+
x: 38.8889,
|
|
3230
|
+
y: 0
|
|
3231
|
+
}
|
|
3232
|
+
],
|
|
3233
|
+
internalTextInset: {
|
|
3234
|
+
top: .2,
|
|
3235
|
+
right: .1,
|
|
3236
|
+
bottom: .2,
|
|
3237
|
+
left: .38
|
|
3238
|
+
}
|
|
3239
|
+
},
|
|
3240
|
+
{
|
|
3241
|
+
key: "arrow-up",
|
|
3242
|
+
type: "polygon",
|
|
3243
|
+
...G({
|
|
3244
|
+
width: 28,
|
|
3245
|
+
height: 36
|
|
3246
|
+
}),
|
|
3247
|
+
points: [
|
|
3248
|
+
{
|
|
3249
|
+
x: 71.4286,
|
|
3250
|
+
y: 100
|
|
3251
|
+
},
|
|
3252
|
+
{
|
|
3253
|
+
x: 28.5714,
|
|
3254
|
+
y: 100
|
|
3065
3255
|
},
|
|
3066
3256
|
{
|
|
3067
|
-
x:
|
|
3068
|
-
y:
|
|
3257
|
+
x: 28.5714,
|
|
3258
|
+
y: 38.8889
|
|
3069
3259
|
},
|
|
3070
3260
|
{
|
|
3071
3261
|
x: 0,
|
|
3072
|
-
y:
|
|
3262
|
+
y: 38.8889
|
|
3263
|
+
},
|
|
3264
|
+
{
|
|
3265
|
+
x: 50,
|
|
3266
|
+
y: 0
|
|
3267
|
+
},
|
|
3268
|
+
{
|
|
3269
|
+
x: 100,
|
|
3270
|
+
y: 38.8889
|
|
3271
|
+
},
|
|
3272
|
+
{
|
|
3273
|
+
x: 71.4286,
|
|
3274
|
+
y: 38.8889
|
|
3073
3275
|
}
|
|
3074
3276
|
],
|
|
3075
3277
|
internalTextInset: {
|
|
3076
|
-
top: .
|
|
3077
|
-
right: .
|
|
3078
|
-
bottom: .
|
|
3079
|
-
left: .
|
|
3278
|
+
top: .38,
|
|
3279
|
+
right: .2,
|
|
3280
|
+
bottom: .1,
|
|
3281
|
+
left: .2
|
|
3080
3282
|
}
|
|
3081
3283
|
},
|
|
3082
3284
|
{
|
|
3083
3285
|
key: "arrow-down-fat",
|
|
3084
3286
|
type: "polygon",
|
|
3085
3287
|
width: 130,
|
|
3086
|
-
height:
|
|
3288
|
+
height: W,
|
|
3087
3289
|
points: [
|
|
3088
3290
|
{
|
|
3089
3291
|
x: 38,
|
|
@@ -3122,193 +3324,315 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3122
3324
|
}
|
|
3123
3325
|
},
|
|
3124
3326
|
{
|
|
3125
|
-
key: "arrow-
|
|
3327
|
+
key: "arrow-down",
|
|
3126
3328
|
type: "polygon",
|
|
3127
|
-
|
|
3128
|
-
|
|
3329
|
+
...G({
|
|
3330
|
+
width: 28,
|
|
3331
|
+
height: 36
|
|
3332
|
+
}),
|
|
3129
3333
|
points: [
|
|
3130
3334
|
{
|
|
3131
|
-
x:
|
|
3335
|
+
x: 0,
|
|
3336
|
+
y: 61.1111
|
|
3337
|
+
},
|
|
3338
|
+
{
|
|
3339
|
+
x: 28.5714,
|
|
3340
|
+
y: 61.1111
|
|
3341
|
+
},
|
|
3342
|
+
{
|
|
3343
|
+
x: 28.5714,
|
|
3132
3344
|
y: 0
|
|
3133
3345
|
},
|
|
3134
3346
|
{
|
|
3135
|
-
x:
|
|
3136
|
-
y:
|
|
3347
|
+
x: 71.4286,
|
|
3348
|
+
y: 0
|
|
3137
3349
|
},
|
|
3138
3350
|
{
|
|
3139
|
-
x:
|
|
3140
|
-
y:
|
|
3351
|
+
x: 71.4286,
|
|
3352
|
+
y: 61.1111
|
|
3141
3353
|
},
|
|
3142
3354
|
{
|
|
3143
|
-
x:
|
|
3144
|
-
y:
|
|
3355
|
+
x: 100,
|
|
3356
|
+
y: 61.1111
|
|
3145
3357
|
},
|
|
3146
3358
|
{
|
|
3147
|
-
x:
|
|
3148
|
-
y:
|
|
3359
|
+
x: 50,
|
|
3360
|
+
y: 100
|
|
3361
|
+
}
|
|
3362
|
+
],
|
|
3363
|
+
internalTextInset: {
|
|
3364
|
+
top: .1,
|
|
3365
|
+
right: .2,
|
|
3366
|
+
bottom: .38,
|
|
3367
|
+
left: .2
|
|
3368
|
+
}
|
|
3369
|
+
},
|
|
3370
|
+
{
|
|
3371
|
+
key: "arrow-up-down",
|
|
3372
|
+
type: "polygon",
|
|
3373
|
+
...G({
|
|
3374
|
+
width: 20,
|
|
3375
|
+
height: 38
|
|
3376
|
+
}),
|
|
3377
|
+
points: [
|
|
3378
|
+
{
|
|
3379
|
+
x: 70,
|
|
3380
|
+
y: 73.6842
|
|
3381
|
+
},
|
|
3382
|
+
{
|
|
3383
|
+
x: 100,
|
|
3384
|
+
y: 73.6842
|
|
3149
3385
|
},
|
|
3150
3386
|
{
|
|
3151
3387
|
x: 50,
|
|
3152
3388
|
y: 100
|
|
3153
3389
|
},
|
|
3154
3390
|
{
|
|
3155
|
-
x:
|
|
3156
|
-
y:
|
|
3391
|
+
x: 0,
|
|
3392
|
+
y: 73.6842
|
|
3157
3393
|
},
|
|
3158
3394
|
{
|
|
3159
|
-
x:
|
|
3160
|
-
y:
|
|
3395
|
+
x: 30,
|
|
3396
|
+
y: 73.6842
|
|
3161
3397
|
},
|
|
3162
3398
|
{
|
|
3163
|
-
x:
|
|
3164
|
-
y:
|
|
3399
|
+
x: 30,
|
|
3400
|
+
y: 26.3158
|
|
3165
3401
|
},
|
|
3166
3402
|
{
|
|
3167
|
-
x:
|
|
3168
|
-
y:
|
|
3403
|
+
x: 0,
|
|
3404
|
+
y: 26.3158
|
|
3405
|
+
},
|
|
3406
|
+
{
|
|
3407
|
+
x: 50,
|
|
3408
|
+
y: 0
|
|
3409
|
+
},
|
|
3410
|
+
{
|
|
3411
|
+
x: 100,
|
|
3412
|
+
y: 26.3158
|
|
3413
|
+
},
|
|
3414
|
+
{
|
|
3415
|
+
x: 70,
|
|
3416
|
+
y: 26.3158
|
|
3169
3417
|
}
|
|
3170
3418
|
],
|
|
3171
3419
|
internalTextInset: {
|
|
3172
|
-
top: .
|
|
3173
|
-
right: .
|
|
3174
|
-
bottom: .
|
|
3175
|
-
left: .
|
|
3420
|
+
top: .34,
|
|
3421
|
+
right: .2,
|
|
3422
|
+
bottom: .34,
|
|
3423
|
+
left: .2
|
|
3176
3424
|
}
|
|
3177
3425
|
},
|
|
3178
3426
|
{
|
|
3179
3427
|
key: "arrow-left-right",
|
|
3180
3428
|
type: "polygon",
|
|
3181
|
-
|
|
3182
|
-
|
|
3429
|
+
...G({
|
|
3430
|
+
width: 38,
|
|
3431
|
+
height: 20
|
|
3432
|
+
}),
|
|
3183
3433
|
points: [
|
|
3184
3434
|
{
|
|
3185
|
-
x:
|
|
3435
|
+
x: 100,
|
|
3186
3436
|
y: 50
|
|
3187
3437
|
},
|
|
3188
3438
|
{
|
|
3189
|
-
x:
|
|
3190
|
-
y:
|
|
3439
|
+
x: 73.6842,
|
|
3440
|
+
y: 100
|
|
3191
3441
|
},
|
|
3192
3442
|
{
|
|
3193
|
-
x:
|
|
3194
|
-
y:
|
|
3443
|
+
x: 73.6842,
|
|
3444
|
+
y: 70
|
|
3195
3445
|
},
|
|
3196
3446
|
{
|
|
3197
|
-
x:
|
|
3198
|
-
y:
|
|
3447
|
+
x: 26.3158,
|
|
3448
|
+
y: 70
|
|
3199
3449
|
},
|
|
3200
3450
|
{
|
|
3201
|
-
x:
|
|
3202
|
-
y:
|
|
3451
|
+
x: 26.3158,
|
|
3452
|
+
y: 100
|
|
3203
3453
|
},
|
|
3204
3454
|
{
|
|
3205
|
-
x:
|
|
3455
|
+
x: 0,
|
|
3206
3456
|
y: 50
|
|
3207
3457
|
},
|
|
3208
3458
|
{
|
|
3209
|
-
x:
|
|
3210
|
-
y:
|
|
3459
|
+
x: 26.3158,
|
|
3460
|
+
y: 0
|
|
3211
3461
|
},
|
|
3212
3462
|
{
|
|
3213
|
-
x:
|
|
3214
|
-
y:
|
|
3463
|
+
x: 26.3158,
|
|
3464
|
+
y: 30
|
|
3215
3465
|
},
|
|
3216
3466
|
{
|
|
3217
|
-
x:
|
|
3218
|
-
y:
|
|
3467
|
+
x: 73.6842,
|
|
3468
|
+
y: 30
|
|
3219
3469
|
},
|
|
3220
3470
|
{
|
|
3221
|
-
x:
|
|
3222
|
-
y:
|
|
3471
|
+
x: 73.6842,
|
|
3472
|
+
y: 0
|
|
3223
3473
|
}
|
|
3224
3474
|
],
|
|
3225
3475
|
internalTextInset: {
|
|
3226
|
-
top: .
|
|
3227
|
-
right: .
|
|
3228
|
-
bottom: .26,
|
|
3229
|
-
left: .34
|
|
3230
|
-
}
|
|
3231
|
-
},
|
|
3232
|
-
{
|
|
3233
|
-
key: "drop",
|
|
3234
|
-
type: "path",
|
|
3235
|
-
width: 140,
|
|
3236
|
-
height: G,
|
|
3237
|
-
path: "M50 0 C68 18 88 41 88 62 C88 84 71 100 50 100 C29 100 12 84 12 62 C12 41 32 18 50 0 Z",
|
|
3238
|
-
internalTextInset: {
|
|
3239
|
-
top: .3,
|
|
3240
|
-
right: .27,
|
|
3476
|
+
top: .2,
|
|
3477
|
+
right: .32,
|
|
3241
3478
|
bottom: .2,
|
|
3242
|
-
left: .
|
|
3479
|
+
left: .32
|
|
3243
3480
|
}
|
|
3244
3481
|
},
|
|
3245
3482
|
{
|
|
3246
|
-
key: "
|
|
3483
|
+
key: "banner",
|
|
3247
3484
|
type: "polygon",
|
|
3248
|
-
|
|
3249
|
-
|
|
3485
|
+
...G({
|
|
3486
|
+
width: 36,
|
|
3487
|
+
height: 24
|
|
3488
|
+
}),
|
|
3250
3489
|
points: [
|
|
3251
3490
|
{
|
|
3252
|
-
x:
|
|
3491
|
+
x: 0,
|
|
3492
|
+
y: 100
|
|
3493
|
+
},
|
|
3494
|
+
{
|
|
3495
|
+
x: 0,
|
|
3253
3496
|
y: 0
|
|
3254
3497
|
},
|
|
3255
3498
|
{
|
|
3256
|
-
x:
|
|
3499
|
+
x: 77.7778,
|
|
3257
3500
|
y: 0
|
|
3258
3501
|
},
|
|
3259
3502
|
{
|
|
3260
|
-
x:
|
|
3261
|
-
y:
|
|
3503
|
+
x: 100,
|
|
3504
|
+
y: 50
|
|
3505
|
+
},
|
|
3506
|
+
{
|
|
3507
|
+
x: 77.7778,
|
|
3508
|
+
y: 100
|
|
3509
|
+
}
|
|
3510
|
+
],
|
|
3511
|
+
internalTextInset: {
|
|
3512
|
+
top: .14,
|
|
3513
|
+
right: .26,
|
|
3514
|
+
bottom: .14,
|
|
3515
|
+
left: .12
|
|
3516
|
+
}
|
|
3517
|
+
},
|
|
3518
|
+
{
|
|
3519
|
+
key: "drop",
|
|
3520
|
+
type: "path",
|
|
3521
|
+
...G({
|
|
3522
|
+
width: 26,
|
|
3523
|
+
height: 36
|
|
3524
|
+
}),
|
|
3525
|
+
path: "M0 23C0 11 13 0 13 0s13 11 13 23c0 7.18-5.82 13-13 13S0 30.18 0 23",
|
|
3526
|
+
internalTextInset: {
|
|
3527
|
+
top: .28,
|
|
3528
|
+
right: .26,
|
|
3529
|
+
bottom: .18,
|
|
3530
|
+
left: .26
|
|
3531
|
+
}
|
|
3532
|
+
},
|
|
3533
|
+
{
|
|
3534
|
+
key: "cross",
|
|
3535
|
+
type: "polygon",
|
|
3536
|
+
width: W,
|
|
3537
|
+
height: W,
|
|
3538
|
+
points: [
|
|
3539
|
+
{
|
|
3540
|
+
x: 67.6471,
|
|
3541
|
+
y: 32.3529
|
|
3262
3542
|
},
|
|
3263
3543
|
{
|
|
3264
3544
|
x: 100,
|
|
3265
|
-
y:
|
|
3545
|
+
y: 32.3529
|
|
3266
3546
|
},
|
|
3267
3547
|
{
|
|
3268
3548
|
x: 100,
|
|
3269
|
-
y:
|
|
3549
|
+
y: 67.6471
|
|
3270
3550
|
},
|
|
3271
3551
|
{
|
|
3272
|
-
x:
|
|
3273
|
-
y:
|
|
3552
|
+
x: 67.6471,
|
|
3553
|
+
y: 67.6471
|
|
3274
3554
|
},
|
|
3275
3555
|
{
|
|
3276
|
-
x:
|
|
3556
|
+
x: 67.6471,
|
|
3277
3557
|
y: 100
|
|
3278
3558
|
},
|
|
3279
3559
|
{
|
|
3280
|
-
x:
|
|
3560
|
+
x: 32.3529,
|
|
3281
3561
|
y: 100
|
|
3282
3562
|
},
|
|
3283
3563
|
{
|
|
3284
|
-
x:
|
|
3285
|
-
y:
|
|
3564
|
+
x: 32.3529,
|
|
3565
|
+
y: 67.6471
|
|
3286
3566
|
},
|
|
3287
3567
|
{
|
|
3288
3568
|
x: 0,
|
|
3289
|
-
y:
|
|
3569
|
+
y: 67.6471
|
|
3290
3570
|
},
|
|
3291
3571
|
{
|
|
3292
3572
|
x: 0,
|
|
3293
|
-
y:
|
|
3573
|
+
y: 32.3529
|
|
3294
3574
|
},
|
|
3295
3575
|
{
|
|
3296
|
-
x:
|
|
3297
|
-
y:
|
|
3576
|
+
x: 32.3529,
|
|
3577
|
+
y: 32.3529
|
|
3578
|
+
},
|
|
3579
|
+
{
|
|
3580
|
+
x: 32.3529,
|
|
3581
|
+
y: 0
|
|
3582
|
+
},
|
|
3583
|
+
{
|
|
3584
|
+
x: 67.6471,
|
|
3585
|
+
y: 0
|
|
3298
3586
|
}
|
|
3299
3587
|
],
|
|
3300
3588
|
internalTextInset: {
|
|
3301
|
-
top: .
|
|
3302
|
-
right: .
|
|
3303
|
-
bottom: .
|
|
3304
|
-
left: .
|
|
3589
|
+
top: .32,
|
|
3590
|
+
right: .32,
|
|
3591
|
+
bottom: .32,
|
|
3592
|
+
left: .32
|
|
3593
|
+
}
|
|
3594
|
+
},
|
|
3595
|
+
{
|
|
3596
|
+
key: "ribbon",
|
|
3597
|
+
type: "polygon",
|
|
3598
|
+
...G({
|
|
3599
|
+
width: 24,
|
|
3600
|
+
height: 34
|
|
3601
|
+
}),
|
|
3602
|
+
points: [
|
|
3603
|
+
{
|
|
3604
|
+
x: 0,
|
|
3605
|
+
y: 0
|
|
3606
|
+
},
|
|
3607
|
+
{
|
|
3608
|
+
x: 100,
|
|
3609
|
+
y: 0
|
|
3610
|
+
},
|
|
3611
|
+
{
|
|
3612
|
+
x: 100,
|
|
3613
|
+
y: 100
|
|
3614
|
+
},
|
|
3615
|
+
{
|
|
3616
|
+
x: 50,
|
|
3617
|
+
y: 76.4706
|
|
3618
|
+
},
|
|
3619
|
+
{
|
|
3620
|
+
x: 0,
|
|
3621
|
+
y: 100
|
|
3622
|
+
}
|
|
3623
|
+
],
|
|
3624
|
+
internalTextInset: {
|
|
3625
|
+
top: .16,
|
|
3626
|
+
right: .18,
|
|
3627
|
+
bottom: .28,
|
|
3628
|
+
left: .18
|
|
3305
3629
|
}
|
|
3306
3630
|
},
|
|
3307
3631
|
{
|
|
3308
3632
|
key: "gear",
|
|
3309
3633
|
type: "polygon",
|
|
3310
|
-
width:
|
|
3311
|
-
height:
|
|
3634
|
+
width: W,
|
|
3635
|
+
height: W,
|
|
3312
3636
|
points: it({
|
|
3313
3637
|
spikes: 14,
|
|
3314
3638
|
outerRadius: 50,
|
|
@@ -3325,8 +3649,8 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3325
3649
|
{
|
|
3326
3650
|
key: "badge",
|
|
3327
3651
|
type: "path",
|
|
3328
|
-
width:
|
|
3329
|
-
height:
|
|
3652
|
+
width: W,
|
|
3653
|
+
height: W,
|
|
3330
3654
|
path: "M24 6 H76 L94 24 V76 L76 94 H24 L6 76 V24 Z",
|
|
3331
3655
|
internalTextInset: {
|
|
3332
3656
|
top: .24,
|
|
@@ -3339,7 +3663,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3339
3663
|
key: "bookmark",
|
|
3340
3664
|
type: "polygon",
|
|
3341
3665
|
width: 130,
|
|
3342
|
-
height:
|
|
3666
|
+
height: W,
|
|
3343
3667
|
points: [
|
|
3344
3668
|
{
|
|
3345
3669
|
x: 18,
|
|
@@ -3372,7 +3696,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3372
3696
|
{
|
|
3373
3697
|
key: "tag",
|
|
3374
3698
|
type: "path",
|
|
3375
|
-
width:
|
|
3699
|
+
width: W,
|
|
3376
3700
|
height: 130,
|
|
3377
3701
|
path: "M4 20 L64 20 L96 50 L64 80 L4 80 Z",
|
|
3378
3702
|
internalTextInset: {
|
|
@@ -3386,7 +3710,7 @@ var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3386
3710
|
key: "moon",
|
|
3387
3711
|
type: "path",
|
|
3388
3712
|
width: 150,
|
|
3389
|
-
height:
|
|
3713
|
+
height: W,
|
|
3390
3714
|
path: [
|
|
3391
3715
|
"M68 4 C36 4 10 30 10 62",
|
|
3392
3716
|
"C10 94 36 120 68 120 C85 120 100 112 111 100",
|
|
@@ -3407,26 +3731,26 @@ for (let e = 0; e < at.length; e += 1) {
|
|
|
3407
3731
|
}
|
|
3408
3732
|
var ut = lt, dt = ({ presetKey: e }) => ut[e] ?? null, ft = ({ preset: e, rounding: t }) => (typeof t == "number" ? t : 0) <= 0 || e.type === "rect" ? e.key : e.roundedVariant ?? e.key;
|
|
3409
3733
|
function pt({ value: e, size: t }) {
|
|
3410
|
-
let n = Number.isFinite(e) ? Math.min(Math.max(e, 0),
|
|
3734
|
+
let n = Number.isFinite(e) ? Math.min(Math.max(e, 0), nt) : 0;
|
|
3411
3735
|
return (Number.isFinite(t) && t > 0 ? t : 0) * n;
|
|
3412
3736
|
}
|
|
3413
3737
|
var mt = ({ preset: e, width: t, height: n }) => {
|
|
3414
3738
|
let r = e.internalTextInset ?? {};
|
|
3415
3739
|
return {
|
|
3416
3740
|
top: pt({
|
|
3417
|
-
value: r.top ??
|
|
3741
|
+
value: r.top ?? tt.top,
|
|
3418
3742
|
size: n
|
|
3419
3743
|
}),
|
|
3420
3744
|
right: pt({
|
|
3421
|
-
value: r.right ??
|
|
3745
|
+
value: r.right ?? tt.right,
|
|
3422
3746
|
size: t
|
|
3423
3747
|
}),
|
|
3424
3748
|
bottom: pt({
|
|
3425
|
-
value: r.bottom ??
|
|
3749
|
+
value: r.bottom ?? tt.bottom,
|
|
3426
3750
|
size: n
|
|
3427
3751
|
}),
|
|
3428
3752
|
left: pt({
|
|
3429
|
-
value: r.left ??
|
|
3753
|
+
value: r.left ?? tt.left,
|
|
3430
3754
|
size: t
|
|
3431
3755
|
})
|
|
3432
3756
|
};
|
|
@@ -4816,7 +5140,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4816
5140
|
width: D,
|
|
4817
5141
|
height: O
|
|
4818
5142
|
})
|
|
4819
|
-
}), f.set({
|
|
5143
|
+
}), r.shapeReplaceBoxWidth = Math.max(1, r.shapeBaseWidth ?? D), r.shapeReplaceBoxHeight = Math.max(1, r.shapeBaseHeight ?? O), f.set({
|
|
4820
5144
|
scaleX: 1,
|
|
4821
5145
|
scaleY: 1
|
|
4822
5146
|
}), r.set({
|
|
@@ -5085,7 +5409,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5085
5409
|
width: u,
|
|
5086
5410
|
height: d
|
|
5087
5411
|
})
|
|
5088
|
-
}), t.set({
|
|
5412
|
+
}), t.shapeReplaceBoxWidth = Math.max(1, t.shapeBaseWidth ?? u), t.shapeReplaceBoxHeight = Math.max(1, t.shapeBaseHeight ?? d), t.set({
|
|
5089
5413
|
left: i.lastAllowedLeft,
|
|
5090
5414
|
top: i.lastAllowedTop,
|
|
5091
5415
|
flipX: i.lastAllowedFlipX,
|
|
@@ -5428,7 +5752,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5428
5752
|
}
|
|
5429
5753
|
}), I;
|
|
5430
5754
|
}
|
|
5431
|
-
}, or = "#
|
|
5755
|
+
}, or = "#B4B7BD", sr = 0, cr = 1, lr = class {
|
|
5432
5756
|
constructor({ editor: e }) {
|
|
5433
5757
|
this._handleObjectScaling = (e) => {
|
|
5434
5758
|
let t = e.target && J(e.target) ? e.target : null;
|
|
@@ -5588,44 +5912,55 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5588
5912
|
if (!r) return null;
|
|
5589
5913
|
let i = dt({ presetKey: t ?? r.shapePresetKey ?? "circle" });
|
|
5590
5914
|
if (!i) return null;
|
|
5591
|
-
let { left: a, top: o, originX: s, originY: c, width: l, height: u,
|
|
5915
|
+
let { left: a, top: o, originX: s, originY: c, width: l, height: u, preserveCurrentAspectRatio: d, shapeTextAutoExpand: f, text: p, textStyle: m, alignH: h, alignV: g, textPadding: _, rounding: v, withoutSelection: y, withoutSave: b } = n, x = this.editor.canvasManager.resolveObjectPlacement({
|
|
5592
5916
|
object: r,
|
|
5593
5917
|
left: a,
|
|
5594
5918
|
top: o,
|
|
5595
5919
|
originX: s,
|
|
5596
5920
|
originY: c
|
|
5597
|
-
}),
|
|
5921
|
+
}), S = this._resolveCurrentDimensions({ group: r }), C = this._resolveManualDimensions({ group: r }), w = this._resolveReplaceBoxDimensions({ group: r }), T = this._isShapeTextAutoExpandEnabled({ group: r }), E = f === void 0 ? T : f !== !1, D = v ?? r.shapeRounding ?? 0, O = dt({ presetKey: ft({
|
|
5598
5922
|
preset: i,
|
|
5599
|
-
rounding:
|
|
5600
|
-
}) }) ?? i,
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
}
|
|
5923
|
+
rounding: D
|
|
5924
|
+
}) }) ?? i, { width: k, height: A } = O, j = !!d, M = t !== void 0, N = M && !j ? {
|
|
5925
|
+
width: Math.max(1, l ?? w.width),
|
|
5926
|
+
height: Math.max(1, u ?? w.height)
|
|
5927
|
+
} : null, { width: P, height: F } = N ? this._resolveAspectRatioFittedDimensions({
|
|
5928
|
+
targetWidth: N.width,
|
|
5929
|
+
targetHeight: N.height,
|
|
5930
|
+
aspectWidth: k,
|
|
5931
|
+
aspectHeight: A
|
|
5932
|
+
}) : {
|
|
5933
|
+
width: Math.max(1, l ?? S.width),
|
|
5934
|
+
height: Math.max(1, u ?? S.height)
|
|
5935
|
+
}, I = h ?? r.shapeAlignHorizontal ?? "center", ee = g ?? r.shapeAlignVertical ?? "middle", te = this._resolveGroupUserPadding({ group: r }), L = Wt({ padding: _ }), ne = Vt({
|
|
5936
|
+
base: te,
|
|
5937
|
+
override: _
|
|
5938
|
+
}), re = this._resolveShapeStyle({
|
|
5604
5939
|
options: n,
|
|
5605
5940
|
fallback: r
|
|
5606
|
-
}),
|
|
5941
|
+
}), R = Ut({
|
|
5607
5942
|
baseInset: mt({
|
|
5608
|
-
preset:
|
|
5609
|
-
width:
|
|
5610
|
-
height:
|
|
5943
|
+
preset: O,
|
|
5944
|
+
width: P,
|
|
5945
|
+
height: F
|
|
5611
5946
|
}),
|
|
5612
|
-
stroke:
|
|
5613
|
-
strokeWidth:
|
|
5614
|
-
}),
|
|
5615
|
-
base:
|
|
5616
|
-
addition:
|
|
5617
|
-
}),
|
|
5618
|
-
l !== void 0 && (
|
|
5619
|
-
let
|
|
5620
|
-
if (!
|
|
5621
|
-
let
|
|
5947
|
+
stroke: re.stroke,
|
|
5948
|
+
strokeWidth: re.strokeWidth
|
|
5949
|
+
}), ie = Ht({
|
|
5950
|
+
base: R,
|
|
5951
|
+
addition: ne
|
|
5952
|
+
}), z = C.width, B = C.height;
|
|
5953
|
+
M && (z = P, B = F), !M && l !== void 0 && (z = Math.max(1, l)), !M && u !== void 0 && (B = Math.max(1, u)), !M && l === void 0 && T && !E && (z = S.width);
|
|
5954
|
+
let { shape: V, text: H } = Y({ group: r });
|
|
5955
|
+
if (!V || !H) return null;
|
|
5956
|
+
let U = this.lifecycleController.createContext({
|
|
5622
5957
|
group: r,
|
|
5623
5958
|
source: "update",
|
|
5624
5959
|
target: e,
|
|
5625
|
-
presetKey:
|
|
5960
|
+
presetKey: O.key,
|
|
5626
5961
|
options: n,
|
|
5627
|
-
withoutSave:
|
|
5628
|
-
}),
|
|
5962
|
+
withoutSave: b
|
|
5963
|
+
}), ae = {
|
|
5629
5964
|
angle: 0,
|
|
5630
5965
|
skewX: 0,
|
|
5631
5966
|
skewY: 0,
|
|
@@ -5638,74 +5973,97 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5638
5973
|
top: 0,
|
|
5639
5974
|
originX: "left",
|
|
5640
5975
|
originY: "top"
|
|
5641
|
-
},
|
|
5642
|
-
text:
|
|
5643
|
-
textStyle: this._resolveCurrentTextStyle({ textNode:
|
|
5644
|
-
width: Math.max(1,
|
|
5645
|
-
align:
|
|
5976
|
+
}, oe = H, se = this._createTextNode({
|
|
5977
|
+
text: oe.textCaseRaw ?? H.text ?? "",
|
|
5978
|
+
textStyle: this._resolveCurrentTextStyle({ textNode: H }),
|
|
5979
|
+
width: Math.max(1, H.width ?? S.width),
|
|
5980
|
+
align: I
|
|
5646
5981
|
});
|
|
5647
|
-
|
|
5648
|
-
textNode:
|
|
5649
|
-
text:
|
|
5650
|
-
textStyle:
|
|
5651
|
-
align:
|
|
5982
|
+
se.set(ae), this._applyTextUpdates({
|
|
5983
|
+
textNode: se,
|
|
5984
|
+
text: p,
|
|
5985
|
+
textStyle: m,
|
|
5986
|
+
align: I
|
|
5652
5987
|
});
|
|
5653
|
-
let
|
|
5654
|
-
text:
|
|
5655
|
-
currentWidth:
|
|
5656
|
-
manualWidth:
|
|
5657
|
-
shapeTextAutoExpandEnabled:
|
|
5658
|
-
padding:
|
|
5659
|
-
}),
|
|
5660
|
-
preset:
|
|
5661
|
-
width:
|
|
5662
|
-
height:
|
|
5663
|
-
style:
|
|
5664
|
-
rounding:
|
|
5665
|
-
}),
|
|
5666
|
-
if (
|
|
5667
|
-
let
|
|
5668
|
-
this._detachShapeGroupAutoLayout({ group: r }),
|
|
5669
|
-
textNode:
|
|
5670
|
-
text:
|
|
5671
|
-
textStyle:
|
|
5672
|
-
align:
|
|
5673
|
-
}), r.remove(
|
|
5988
|
+
let ce = l === void 0 && u === void 0 && t === void 0 && f === void 0 && v === void 0 && p === void 0 && !this._hasShapeTextSizeAffectingStyleChanges({ textStyle: m }), le = _ !== void 0 && ce, ue = ce ? S.width : this._resolveShapeLayoutWidth({
|
|
5989
|
+
text: se,
|
|
5990
|
+
currentWidth: P,
|
|
5991
|
+
manualWidth: z,
|
|
5992
|
+
shapeTextAutoExpandEnabled: E,
|
|
5993
|
+
padding: ie
|
|
5994
|
+
}), de = await Pt({
|
|
5995
|
+
preset: O,
|
|
5996
|
+
width: ue,
|
|
5997
|
+
height: F,
|
|
5998
|
+
style: re,
|
|
5999
|
+
rounding: D
|
|
6000
|
+
}), fe = r.getObjects().indexOf(V);
|
|
6001
|
+
if (fe < 0) return null;
|
|
6002
|
+
let pe = () => {
|
|
6003
|
+
this._detachShapeGroupAutoLayout({ group: r }), H.set(ae), this._applyTextUpdates({
|
|
6004
|
+
textNode: H,
|
|
6005
|
+
text: p,
|
|
6006
|
+
textStyle: m,
|
|
6007
|
+
align: I
|
|
6008
|
+
}), r.remove(V), r.insertAt(fe, de), this._applyShapeGroupMetadata({
|
|
5674
6009
|
group: r,
|
|
5675
|
-
presetKey:
|
|
5676
|
-
presetCanRound: gt({ preset:
|
|
5677
|
-
width:
|
|
5678
|
-
height:
|
|
5679
|
-
manualWidth:
|
|
5680
|
-
manualHeight:
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
6010
|
+
presetKey: O.key,
|
|
6011
|
+
presetCanRound: gt({ preset: O }),
|
|
6012
|
+
width: ue,
|
|
6013
|
+
height: F,
|
|
6014
|
+
manualWidth: z,
|
|
6015
|
+
manualHeight: B,
|
|
6016
|
+
replaceBoxWidth: N?.width,
|
|
6017
|
+
replaceBoxHeight: N?.height,
|
|
6018
|
+
shapeTextAutoExpand: E,
|
|
6019
|
+
alignH: I,
|
|
6020
|
+
alignV: ee,
|
|
6021
|
+
padding: ne,
|
|
6022
|
+
style: re,
|
|
6023
|
+
rounding: D
|
|
5687
6024
|
}), this._applyCurrentLayout({
|
|
5688
6025
|
group: r,
|
|
5689
|
-
shape:
|
|
5690
|
-
text:
|
|
5691
|
-
placement:
|
|
5692
|
-
width:
|
|
5693
|
-
height:
|
|
5694
|
-
alignH:
|
|
5695
|
-
alignV:
|
|
5696
|
-
internalShapeTextInset:
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
6026
|
+
shape: de,
|
|
6027
|
+
text: H,
|
|
6028
|
+
placement: x,
|
|
6029
|
+
width: ue,
|
|
6030
|
+
height: F,
|
|
6031
|
+
alignH: I,
|
|
6032
|
+
alignV: ee,
|
|
6033
|
+
internalShapeTextInset: R,
|
|
6034
|
+
minimumReplaceBox: N ?? void 0,
|
|
6035
|
+
expandShapeHeightToFitText: !le,
|
|
6036
|
+
changedPadding: L
|
|
6037
|
+
}), H.isEditing && this.editingPlacements.set(r, x);
|
|
5700
6038
|
};
|
|
5701
|
-
if (!this._isOnCanvas({ object: r })) return
|
|
6039
|
+
if (!this._isOnCanvas({ object: r })) return pe(), this.lifecycleController.fireBefore({ lifecycle: U }), this.lifecycleController.fireUpdated({ lifecycle: U }), r;
|
|
5702
6040
|
this._beginMutation();
|
|
5703
6041
|
try {
|
|
5704
|
-
|
|
6042
|
+
pe(), !H.isEditing && !y && this.editor.canvas.setActiveObject(r), this.lifecycleController.fireBefore({ lifecycle: U }), this.editor.canvas.requestRenderAll();
|
|
5705
6043
|
} finally {
|
|
5706
|
-
this._endMutation({ withoutSave:
|
|
6044
|
+
this._endMutation({ withoutSave: b });
|
|
5707
6045
|
}
|
|
5708
|
-
return this.lifecycleController.fireUpdated({ lifecycle:
|
|
6046
|
+
return this.lifecycleController.fireUpdated({ lifecycle: U }), r;
|
|
6047
|
+
}
|
|
6048
|
+
_resolveAspectRatioFittedDimensions({ targetWidth: e, targetHeight: t, aspectWidth: n, aspectHeight: r }) {
|
|
6049
|
+
let i = Math.max(1, n), a = Math.max(1, r), o = e === void 0 ? void 0 : Math.max(1, e), s = t === void 0 ? void 0 : Math.max(1, t);
|
|
6050
|
+
if (o !== void 0 && s === void 0) return {
|
|
6051
|
+
width: o,
|
|
6052
|
+
height: o / i * a
|
|
6053
|
+
};
|
|
6054
|
+
if (o === void 0 && s !== void 0) return {
|
|
6055
|
+
width: s / a * i,
|
|
6056
|
+
height: s
|
|
6057
|
+
};
|
|
6058
|
+
if (o === void 0 || s === void 0) return {
|
|
6059
|
+
width: i,
|
|
6060
|
+
height: a
|
|
6061
|
+
};
|
|
6062
|
+
let c = Math.min(o / i, s / a);
|
|
6063
|
+
return {
|
|
6064
|
+
width: i * c,
|
|
6065
|
+
height: a * c
|
|
6066
|
+
};
|
|
5709
6067
|
}
|
|
5710
6068
|
remove({ target: e, withoutSave: t } = {}) {
|
|
5711
6069
|
let n = this._resolveShapeGroup({ target: e });
|
|
@@ -5926,10 +6284,10 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5926
6284
|
padding: f,
|
|
5927
6285
|
internalShapeTextInset: p,
|
|
5928
6286
|
changedPadding: m
|
|
5929
|
-
}), this._detachShapeGroupAutoLayout({ group: _ }), _;
|
|
6287
|
+
}), _.shapeReplaceBoxWidth = Math.max(1, _.shapeBaseWidth ?? a), _.shapeReplaceBoxHeight = Math.max(1, _.shapeBaseHeight ?? o), this._detachShapeGroupAutoLayout({ group: _ }), _;
|
|
5930
6288
|
}
|
|
5931
|
-
_applyShapeGroupMetadata({ group: e, presetKey: t, presetCanRound: n, width: r, height: i, manualWidth: a, manualHeight: o,
|
|
5932
|
-
let
|
|
6289
|
+
_applyShapeGroupMetadata({ group: e, presetKey: t, presetCanRound: n, width: r, height: i, manualWidth: a, manualHeight: o, replaceBoxWidth: s, replaceBoxHeight: c, shapeTextAutoExpand: l, alignH: u, alignV: d, padding: f, style: p, rounding: m }) {
|
|
6290
|
+
let h = p.strokeDashArray ? p.strokeDashArray.slice() : p.strokeDashArray ?? null;
|
|
5933
6291
|
e.set({
|
|
5934
6292
|
shapeComposite: !0,
|
|
5935
6293
|
shapePresetKey: t,
|
|
@@ -5937,19 +6295,21 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5937
6295
|
shapeBaseHeight: i,
|
|
5938
6296
|
shapeManualBaseWidth: Math.max(1, a ?? r),
|
|
5939
6297
|
shapeManualBaseHeight: Math.max(1, o ?? i),
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
6298
|
+
shapeReplaceBoxWidth: Math.max(1, s ?? r),
|
|
6299
|
+
shapeReplaceBoxHeight: Math.max(1, c ?? i),
|
|
6300
|
+
shapeTextAutoExpand: l,
|
|
6301
|
+
shapeAlignHorizontal: u,
|
|
6302
|
+
shapeAlignVertical: d,
|
|
6303
|
+
shapePaddingTop: f.top,
|
|
6304
|
+
shapePaddingRight: f.right,
|
|
6305
|
+
shapePaddingBottom: f.bottom,
|
|
6306
|
+
shapePaddingLeft: f.left,
|
|
6307
|
+
shapeFill: p.fill,
|
|
6308
|
+
shapeStroke: p.stroke,
|
|
6309
|
+
shapeStrokeWidth: p.strokeWidth,
|
|
6310
|
+
shapeStrokeDashArray: h,
|
|
6311
|
+
shapeOpacity: p.opacity,
|
|
6312
|
+
shapeRounding: Math.max(0, m ?? 0),
|
|
5953
6313
|
shapeCanRound: n
|
|
5954
6314
|
});
|
|
5955
6315
|
}
|
|
@@ -6046,6 +6406,13 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6046
6406
|
height: Math.max(1, e.shapeManualBaseHeight ?? e.shapeBaseHeight ?? e.height ?? 1)
|
|
6047
6407
|
};
|
|
6048
6408
|
}
|
|
6409
|
+
_resolveReplaceBoxDimensions({ group: e }) {
|
|
6410
|
+
let t = this._resolveCurrentDimensions({ group: e });
|
|
6411
|
+
return {
|
|
6412
|
+
width: Math.max(1, e.shapeReplaceBoxWidth ?? t.width),
|
|
6413
|
+
height: Math.max(1, e.shapeReplaceBoxHeight ?? t.height)
|
|
6414
|
+
};
|
|
6415
|
+
}
|
|
6049
6416
|
_resolveGroupUserPadding({ group: e }) {
|
|
6050
6417
|
return zt({ padding: {
|
|
6051
6418
|
top: e.shapePaddingTop,
|
|
@@ -6097,42 +6464,42 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6097
6464
|
let n = t?.align;
|
|
6098
6465
|
return n === "left" || n === "center" || n === "right" || n === "justify" ? n : e.shapeAlignHorizontal ?? "center";
|
|
6099
6466
|
}
|
|
6100
|
-
_applyCurrentLayout({ group: e, shape: t, text: n, placement: r, width: i, height: a, alignH: o, alignV: s, internalShapeTextInset: c,
|
|
6101
|
-
let
|
|
6102
|
-
|
|
6467
|
+
_applyCurrentLayout({ group: e, shape: t, text: n, placement: r, width: i, height: a, alignH: o, alignV: s, internalShapeTextInset: c, minimumReplaceBox: l, expandShapeHeightToFitText: u = !0, changedPadding: d }) {
|
|
6468
|
+
let f = this._resolveCurrentDimensions({ group: e }), p = this._resolveManualDimensions({ group: e }), m = this._resolveGroupUserPadding({ group: e }), h = f.width;
|
|
6469
|
+
h = i === void 0 ? this._resolveShapeLayoutWidth({
|
|
6103
6470
|
text: n,
|
|
6104
|
-
currentWidth:
|
|
6105
|
-
manualWidth:
|
|
6471
|
+
currentWidth: f.width,
|
|
6472
|
+
manualWidth: p.width,
|
|
6106
6473
|
shapeTextAutoExpandEnabled: this._isShapeTextAutoExpandEnabled({ group: e }),
|
|
6107
6474
|
padding: Ht({
|
|
6108
6475
|
base: c ?? this._resolveGroupInternalShapeTextInset({
|
|
6109
6476
|
group: e,
|
|
6110
|
-
width:
|
|
6111
|
-
height: Math.max(1, a ??
|
|
6477
|
+
width: h,
|
|
6478
|
+
height: Math.max(1, a ?? f.height)
|
|
6112
6479
|
}),
|
|
6113
|
-
addition:
|
|
6480
|
+
addition: m
|
|
6114
6481
|
})
|
|
6115
6482
|
}) : Math.max(1, i);
|
|
6116
|
-
let
|
|
6483
|
+
let g = Math.max(1, a ?? f.height), _ = c ?? this._resolveGroupInternalShapeTextInset({
|
|
6117
6484
|
group: e,
|
|
6118
|
-
width:
|
|
6119
|
-
height:
|
|
6120
|
-
}),
|
|
6485
|
+
width: h,
|
|
6486
|
+
height: g
|
|
6487
|
+
}), v = r ?? this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
6121
6488
|
rn({
|
|
6122
6489
|
group: e,
|
|
6123
6490
|
shape: t,
|
|
6124
6491
|
text: n,
|
|
6125
|
-
width:
|
|
6126
|
-
height:
|
|
6492
|
+
width: h,
|
|
6493
|
+
height: g,
|
|
6127
6494
|
alignH: o ?? e.shapeAlignHorizontal ?? "center",
|
|
6128
6495
|
alignV: s ?? e.shapeAlignVertical ?? "middle",
|
|
6129
|
-
padding:
|
|
6130
|
-
internalShapeTextInset:
|
|
6131
|
-
expandShapeHeightToFitText:
|
|
6132
|
-
changedPadding:
|
|
6133
|
-
}), this.editor.canvasManager.applyObjectPlacement({
|
|
6496
|
+
padding: m,
|
|
6497
|
+
internalShapeTextInset: _,
|
|
6498
|
+
expandShapeHeightToFitText: u,
|
|
6499
|
+
changedPadding: d
|
|
6500
|
+
}), e.shapeReplaceBoxWidth = Math.max(1, l?.width ?? 0, e.shapeBaseWidth ?? h), e.shapeReplaceBoxHeight = Math.max(1, l?.height ?? 0, e.shapeBaseHeight ?? g), this.editor.canvasManager.applyObjectPlacement({
|
|
6134
6501
|
object: e,
|
|
6135
|
-
placement:
|
|
6502
|
+
placement: v
|
|
6136
6503
|
});
|
|
6137
6504
|
}
|
|
6138
6505
|
_syncShapeTextLayoutAfterTextMutation({ textNode: e, textStyle: t }) {
|
|
@@ -7616,7 +7983,7 @@ var Xr = class {
|
|
|
7616
7983
|
N = e, P = e;
|
|
7617
7984
|
}
|
|
7618
7985
|
} else l && (N = Math.max(i.minimumWidthScale, i.lastAllowedScaleX * h)), u && (P = Math.max(i.minimumFontScale, i.lastAllowedScaleY * g));
|
|
7619
|
-
let { appliedWidth: ee, dimensionsRounded:
|
|
7986
|
+
let { appliedWidth: ee, dimensionsRounded: te } = Ur({
|
|
7620
7987
|
textbox: n,
|
|
7621
7988
|
canvasManager: this.canvasManager,
|
|
7622
7989
|
base: a,
|
|
@@ -7652,7 +8019,7 @@ var Xr = class {
|
|
|
7652
8019
|
bottomLeft: D
|
|
7653
8020
|
},
|
|
7654
8021
|
previousWidth: M,
|
|
7655
|
-
dimensionsRounded:
|
|
8022
|
+
dimensionsRounded: te,
|
|
7656
8023
|
isCornerHandle: c,
|
|
7657
8024
|
isHorizontalHandle: l,
|
|
7658
8025
|
isVerticalHandle: u,
|
|
@@ -7913,7 +8280,7 @@ var Xr = class {
|
|
|
7913
8280
|
let F = i ?? this._getDefaultFontFamily(), I = wr({ width: m }), ee = Cr({
|
|
7914
8281
|
strokeColor: p,
|
|
7915
8282
|
width: I
|
|
7916
|
-
}),
|
|
8283
|
+
}), te = {
|
|
7917
8284
|
id: t,
|
|
7918
8285
|
fontFamily: F,
|
|
7919
8286
|
fontSize: a,
|
|
@@ -7939,33 +8306,33 @@ var Xr = class {
|
|
|
7939
8306
|
radiusBottomRight: w,
|
|
7940
8307
|
radiusBottomLeft: T,
|
|
7941
8308
|
...E
|
|
7942
|
-
},
|
|
7943
|
-
|
|
7944
|
-
let
|
|
7945
|
-
if (
|
|
7946
|
-
let e = Tr({ value:
|
|
7947
|
-
e !==
|
|
7948
|
-
}
|
|
7949
|
-
Br({ textbox:
|
|
7950
|
-
let
|
|
7951
|
-
|
|
7952
|
-
object:
|
|
8309
|
+
}, L = new Dr(n, te), ne = r !== !1;
|
|
8310
|
+
L.autoExpand = ne;
|
|
8311
|
+
let re = E.left !== void 0 || E.top !== void 0;
|
|
8312
|
+
if (L.textCaseRaw = L.text ?? "", l) {
|
|
8313
|
+
let e = Tr({ value: L.textCaseRaw });
|
|
8314
|
+
e !== L.text && L.set({ text: e });
|
|
8315
|
+
}
|
|
8316
|
+
Br({ textbox: L }) && (L.dirty = !0);
|
|
8317
|
+
let R;
|
|
8318
|
+
re && (R = M.resolveObjectPlacement({
|
|
8319
|
+
object: L,
|
|
7953
8320
|
left: E.left,
|
|
7954
8321
|
top: E.top,
|
|
7955
8322
|
originX: E.originX,
|
|
7956
8323
|
originY: E.originY,
|
|
7957
8324
|
fallbackPoint: M.getMontageAreaSceneCenter()
|
|
7958
8325
|
}));
|
|
7959
|
-
let
|
|
7960
|
-
return (
|
|
7961
|
-
textbox:
|
|
7962
|
-
placement:
|
|
7963
|
-
shouldAutoExpand:
|
|
7964
|
-
clampToMontage:
|
|
7965
|
-
}),
|
|
7966
|
-
textbox:
|
|
8326
|
+
let ie = ne && e._hasWrappedLinesBeyondExplicitBreaks(L);
|
|
8327
|
+
return (re || ie) && this._normalizeTextboxAfterContentChange({
|
|
8328
|
+
textbox: L,
|
|
8329
|
+
placement: R,
|
|
8330
|
+
shouldAutoExpand: ie,
|
|
8331
|
+
clampToMontage: re
|
|
8332
|
+
}), R || M.centerObjectToMontageArea({ object: L }), A || P.add(L), O || P.setActiveObject(L), P.requestRenderAll(), N.resumeHistory(), k || N.saveState(), j && P.fire("editor:text-added", {
|
|
8333
|
+
textbox: L,
|
|
7967
8334
|
options: {
|
|
7968
|
-
...
|
|
8335
|
+
...te,
|
|
7969
8336
|
text: n,
|
|
7970
8337
|
bold: o,
|
|
7971
8338
|
italic: s,
|
|
@@ -7980,86 +8347,86 @@ var Xr = class {
|
|
|
7980
8347
|
withoutSave: !!k,
|
|
7981
8348
|
withoutAdding: !!A
|
|
7982
8349
|
}
|
|
7983
|
-
}),
|
|
8350
|
+
}), L;
|
|
7984
8351
|
}
|
|
7985
8352
|
updateText({ target: t, style: n = {}, withoutSave: r, skipRender: i, selectionRange: a, emitLifecycleEvents: o = !0 } = {}) {
|
|
7986
8353
|
let s = this._resolveTextObject(t);
|
|
7987
8354
|
if (!s) return null;
|
|
7988
8355
|
let { text: c = "" } = s, { historyManager: l } = this.editor, { canvasManager: u } = this.editor, { canvas: d } = this;
|
|
7989
8356
|
l.suspendHistory();
|
|
7990
|
-
let f = e._getSnapshot(s), { text: p, autoExpand: m, fontFamily: h, fontSize: g, bold: _, italic: v, underline: y, uppercase: b, strikethrough: x, align: S, color: C, strokeColor: w, strokeWidth: T, opacity: E, backgroundColor: D, backgroundOpacity: O, paddingTop: k, paddingRight: A, paddingBottom: j, paddingLeft: M, radiusTopLeft: N, radiusTopRight: P, radiusBottomRight: F, radiusBottomLeft: I, left: ee, top:
|
|
8357
|
+
let f = e._getSnapshot(s), { text: p, autoExpand: m, fontFamily: h, fontSize: g, bold: _, italic: v, underline: y, uppercase: b, strikethrough: x, align: S, color: C, strokeColor: w, strokeWidth: T, opacity: E, backgroundColor: D, backgroundOpacity: O, paddingTop: k, paddingRight: A, paddingBottom: j, paddingLeft: M, radiusTopLeft: N, radiusTopRight: P, radiusBottomRight: F, radiusBottomLeft: I, left: ee, top: te, originX: L, originY: ne, ...re } = n, R = { ...re }, ie = u.resolveObjectPlacement({
|
|
7991
8358
|
object: s,
|
|
7992
8359
|
left: ee,
|
|
7993
|
-
top:
|
|
7994
|
-
originX:
|
|
7995
|
-
originY:
|
|
7996
|
-
}),
|
|
8360
|
+
top: te,
|
|
8361
|
+
originX: L,
|
|
8362
|
+
originY: ne
|
|
8363
|
+
}), z = a === void 0 ? vr({ textbox: s }) : Qr({
|
|
7997
8364
|
text: c,
|
|
7998
8365
|
range: a
|
|
7999
|
-
}),
|
|
8366
|
+
}), B = z ? $r({
|
|
8000
8367
|
textbox: s,
|
|
8001
|
-
range:
|
|
8002
|
-
}) : null,
|
|
8368
|
+
range: z
|
|
8369
|
+
}) : null, V = {}, H = {}, U = {}, ae, oe, se = br({
|
|
8003
8370
|
textbox: s,
|
|
8004
|
-
range:
|
|
8005
|
-
}), ce = !
|
|
8006
|
-
if (h !== void 0 && (
|
|
8371
|
+
range: z
|
|
8372
|
+
}), ce = !z || se, le = !z;
|
|
8373
|
+
if (h !== void 0 && (B && (H.fontFamily = h), ce && (R.fontFamily = h, le && (U.fontFamily = h))), g !== void 0 && (B && (H.fontSize = g), ce && (R.fontSize = g, le && (U.fontSize = g))), _ !== void 0) {
|
|
8007
8374
|
let e = _ ? "bold" : "normal";
|
|
8008
|
-
|
|
8375
|
+
z && (V.fontWeight = e), ce && (R.fontWeight = e, le && (U.fontWeight = e));
|
|
8009
8376
|
}
|
|
8010
8377
|
if (v !== void 0) {
|
|
8011
8378
|
let e = v ? "italic" : "normal";
|
|
8012
|
-
|
|
8379
|
+
z && (V.fontStyle = e), ce && (R.fontStyle = e, le && (U.fontStyle = e));
|
|
8013
8380
|
}
|
|
8014
|
-
if (y !== void 0 && (
|
|
8015
|
-
let e =
|
|
8381
|
+
if (y !== void 0 && (z && (V.underline = y), ce && (R.underline = y, le && (U.underline = y))), x !== void 0 && (z && (V.linethrough = x), ce && (R.linethrough = x, le && (U.linethrough = x))), S !== void 0 && (R.textAlign = S), C !== void 0 && (z && (V.fill = C), ce && (R.fill = C, le && (U.fill = C))), w !== void 0 || T !== void 0) {
|
|
8382
|
+
let e = z ? Sr({
|
|
8016
8383
|
textbox: s,
|
|
8017
|
-
range:
|
|
8384
|
+
range: z,
|
|
8018
8385
|
property: "strokeWidth"
|
|
8019
|
-
}) : void 0, t =
|
|
8386
|
+
}) : void 0, t = z ? Sr({
|
|
8020
8387
|
textbox: s,
|
|
8021
|
-
range:
|
|
8388
|
+
range: z,
|
|
8022
8389
|
property: "stroke"
|
|
8023
8390
|
}) : void 0;
|
|
8024
8391
|
oe = wr({ width: T ?? e ?? s.strokeWidth ?? 0 }), ae = Cr({
|
|
8025
8392
|
strokeColor: w ?? t ?? s.stroke ?? void 0,
|
|
8026
8393
|
width: oe
|
|
8027
|
-
}),
|
|
8394
|
+
}), z && (V.stroke = ae, V.strokeWidth = oe), ce && (R.stroke = ae, R.strokeWidth = oe, le && (U.stroke = ae, U.strokeWidth = oe));
|
|
8028
8395
|
}
|
|
8029
|
-
E !== void 0 && (
|
|
8396
|
+
E !== void 0 && (R.opacity = E), D !== void 0 && (R.backgroundColor = D), O !== void 0 && (R.backgroundOpacity = O), k !== void 0 && (R.paddingTop = k), A !== void 0 && (R.paddingRight = A), j !== void 0 && (R.paddingBottom = j), M !== void 0 && (R.paddingLeft = M), N !== void 0 && (R.radiusTopLeft = N), P !== void 0 && (R.radiusTopRight = P), F !== void 0 && (R.radiusBottomRight = F), I !== void 0 && (R.radiusBottomLeft = I);
|
|
8030
8397
|
let ue = s.textCaseRaw ?? c, de = !!s.uppercase, fe = p !== void 0, pe = fe ? p ?? "" : ue, me = b ?? de, he = me !== de;
|
|
8031
|
-
fe || he ? (
|
|
8398
|
+
fe || he ? (R.text = me ? Tr({ value: pe }) : pe, s.textCaseRaw = pe) : s.textCaseRaw === void 0 && (s.textCaseRaw = ue);
|
|
8032
8399
|
let ge = zr({ stylesList: [
|
|
8033
|
-
|
|
8400
|
+
R,
|
|
8401
|
+
V,
|
|
8034
8402
|
H,
|
|
8035
|
-
ie,
|
|
8036
8403
|
U
|
|
8037
8404
|
] }), _e = [
|
|
8038
8405
|
ee,
|
|
8406
|
+
te,
|
|
8039
8407
|
L,
|
|
8040
|
-
|
|
8041
|
-
te
|
|
8408
|
+
ne
|
|
8042
8409
|
], ve = [
|
|
8043
8410
|
k,
|
|
8044
8411
|
A,
|
|
8045
8412
|
j,
|
|
8046
8413
|
M
|
|
8047
|
-
], ye = _e.some((e) => e !== void 0), be = ve.some((e) => e !== void 0), xe = Object.prototype.hasOwnProperty.call(
|
|
8414
|
+
], ye = _e.some((e) => e !== void 0), be = ve.some((e) => e !== void 0), xe = Object.prototype.hasOwnProperty.call(R, "width"), Se = be && !ye && !fe && !he && !ge && !xe, Ce = null;
|
|
8048
8415
|
Se && (Ce = Ir({
|
|
8049
8416
|
textbox: s,
|
|
8050
|
-
originX:
|
|
8051
|
-
originY:
|
|
8052
|
-
})), s.uppercase = me, s.set(
|
|
8417
|
+
originX: ie.originX,
|
|
8418
|
+
originY: ie.originY
|
|
8419
|
+
})), s.uppercase = me, s.set(R);
|
|
8053
8420
|
let we = !1;
|
|
8054
|
-
if (
|
|
8421
|
+
if (z) {
|
|
8055
8422
|
let e = xr({
|
|
8423
|
+
textbox: s,
|
|
8424
|
+
styles: V,
|
|
8425
|
+
range: z
|
|
8426
|
+
}), t = B ? xr({
|
|
8056
8427
|
textbox: s,
|
|
8057
8428
|
styles: H,
|
|
8058
8429
|
range: B
|
|
8059
|
-
}), t = V ? xr({
|
|
8060
|
-
textbox: s,
|
|
8061
|
-
styles: ie,
|
|
8062
|
-
range: V
|
|
8063
8430
|
}) : !1;
|
|
8064
8431
|
we = e || t;
|
|
8065
8432
|
} else if (Object.keys(U).length) {
|
|
@@ -8071,14 +8438,14 @@ var Xr = class {
|
|
|
8071
8438
|
}));
|
|
8072
8439
|
}
|
|
8073
8440
|
let Te = we && zr({ stylesList: [
|
|
8441
|
+
V,
|
|
8074
8442
|
H,
|
|
8075
|
-
ie,
|
|
8076
8443
|
U
|
|
8077
8444
|
] });
|
|
8078
|
-
if (we && (s.dirty = !0),
|
|
8445
|
+
if (we && (s.dirty = !0), B && (h !== void 0 || g !== void 0)) {
|
|
8079
8446
|
let e = ei({
|
|
8080
8447
|
textbox: s,
|
|
8081
|
-
range:
|
|
8448
|
+
range: B
|
|
8082
8449
|
}), t = {};
|
|
8083
8450
|
h !== void 0 && (t.fontFamily = h), g !== void 0 && (t.fontSize = g), Ar({
|
|
8084
8451
|
textbox: s,
|
|
@@ -8086,10 +8453,10 @@ var Xr = class {
|
|
|
8086
8453
|
updates: t
|
|
8087
8454
|
});
|
|
8088
8455
|
}
|
|
8089
|
-
if (
|
|
8456
|
+
if (z && (C !== void 0 || w !== void 0 || T !== void 0)) {
|
|
8090
8457
|
let e = ti({
|
|
8091
8458
|
textbox: s,
|
|
8092
|
-
range:
|
|
8459
|
+
range: z
|
|
8093
8460
|
}), t = {};
|
|
8094
8461
|
C !== void 0 && (t.fill = C), (w !== void 0 || T !== void 0) && (ae === null && (t.stroke = null), ae != null && (t.stroke = ae)), Ar({
|
|
8095
8462
|
textbox: s,
|
|
@@ -8111,7 +8478,7 @@ var Xr = class {
|
|
|
8111
8478
|
let ke = Oe && !xe && (fe || he || ge);
|
|
8112
8479
|
this._normalizeTextboxAfterContentChange({
|
|
8113
8480
|
textbox: s,
|
|
8114
|
-
placement:
|
|
8481
|
+
placement: ie,
|
|
8115
8482
|
shouldAutoExpand: ke
|
|
8116
8483
|
}), Ce && this._restoreTextboxContentPlacement({
|
|
8117
8484
|
textbox: s,
|
|
@@ -8120,14 +8487,14 @@ var Xr = class {
|
|
|
8120
8487
|
let Ae = {
|
|
8121
8488
|
withoutSave: !!r,
|
|
8122
8489
|
skipRender: !!i
|
|
8123
|
-
}, je = !!
|
|
8490
|
+
}, je = !!z && Object.keys(V).length > 0, Me = {
|
|
8124
8491
|
textbox: s,
|
|
8125
8492
|
target: t,
|
|
8126
8493
|
style: n,
|
|
8127
8494
|
options: Ae,
|
|
8128
|
-
updates:
|
|
8129
|
-
selectionRange:
|
|
8130
|
-
selectionStyles: je ?
|
|
8495
|
+
updates: R,
|
|
8496
|
+
selectionRange: z ?? void 0,
|
|
8497
|
+
selectionStyles: je ? V : void 0
|
|
8131
8498
|
};
|
|
8132
8499
|
o && d.fire("editor:before:text-updated", Me), i || d.requestRenderAll();
|
|
8133
8500
|
let Ne = e._getSnapshot(s);
|
|
@@ -8492,7 +8859,7 @@ var Xr = class {
|
|
|
8492
8859
|
baseWidth: f.baseWidth,
|
|
8493
8860
|
baseHeight: f.baseHeight,
|
|
8494
8861
|
useRelativePositions: m
|
|
8495
|
-
}), this.editor.textManager?.commitStandaloneTextScale({ target: e }),
|
|
8862
|
+
}), this.editor.textManager?.commitStandaloneTextScale({ target: e }), Je({ object: e }), e.set({
|
|
8496
8863
|
id: `${e.type}-${D()}`,
|
|
8497
8864
|
evented: !0
|
|
8498
8865
|
}), n.add(e), e));
|
|
@@ -8560,22 +8927,22 @@ var Xr = class {
|
|
|
8560
8927
|
naturalHeight: 0,
|
|
8561
8928
|
width: 0,
|
|
8562
8929
|
height: 0
|
|
8563
|
-
}, m =
|
|
8930
|
+
}, m = We({
|
|
8564
8931
|
value: u || f || c.width,
|
|
8565
8932
|
fallback: 0
|
|
8566
|
-
}), h =
|
|
8933
|
+
}), h = We({
|
|
8567
8934
|
value: d || p || c.height,
|
|
8568
8935
|
fallback: 0
|
|
8569
|
-
}), g =
|
|
8936
|
+
}), g = We({
|
|
8570
8937
|
value: r,
|
|
8571
8938
|
fallback: m
|
|
8572
|
-
}), _ =
|
|
8939
|
+
}), _ = We({
|
|
8573
8940
|
value: i,
|
|
8574
8941
|
fallback: h
|
|
8575
|
-
}), v =
|
|
8942
|
+
}), v = We({
|
|
8576
8943
|
value: a,
|
|
8577
8944
|
fallback: c.scaleX || 1
|
|
8578
|
-
}), y =
|
|
8945
|
+
}), y = We({
|
|
8579
8946
|
value: o,
|
|
8580
8947
|
fallback: c.scaleY || 1
|
|
8581
8948
|
}), b = g * v, x = _ * y, S = m > 0, C = h > 0, w = b > 0, T = x > 0, E = t._resolveImageFit({ customData: s }), D = {};
|
|
@@ -8642,18 +9009,18 @@ var Xr = class {
|
|
|
8642
9009
|
}
|
|
8643
9010
|
}
|
|
8644
9011
|
_transformObject({ object: e, scale: n, bounds: r, baseWidth: i, baseHeight: a, useRelativePositions: o }) {
|
|
8645
|
-
let s = e, { x: c, y: l } =
|
|
9012
|
+
let s = e, { x: c, y: l } = Ke({
|
|
8646
9013
|
object: e,
|
|
8647
9014
|
baseWidth: i,
|
|
8648
9015
|
baseHeight: a,
|
|
8649
9016
|
useRelativePositions: o
|
|
8650
|
-
}), { scaleX: u, scaleY: d } = e, f =
|
|
9017
|
+
}), { scaleX: u, scaleY: d } = e, f = We({
|
|
8651
9018
|
value: u,
|
|
8652
9019
|
fallback: 1
|
|
8653
|
-
}), p =
|
|
9020
|
+
}), p = We({
|
|
8654
9021
|
value: d,
|
|
8655
9022
|
fallback: 1
|
|
8656
|
-
}), m =
|
|
9023
|
+
}), m = qe({
|
|
8657
9024
|
normalizedX: c,
|
|
8658
9025
|
normalizedY: l,
|
|
8659
9026
|
bounds: t._getPositioningBounds({
|
|
@@ -8729,13 +9096,13 @@ var Xr = class {
|
|
|
8729
9096
|
if (!(e instanceof _)) return;
|
|
8730
9097
|
let r = typeof e.text == "string" ? e.text : "";
|
|
8731
9098
|
if (!r) return;
|
|
8732
|
-
let i =
|
|
9099
|
+
let i = We({
|
|
8733
9100
|
value: this.editor?.montageArea?.width,
|
|
8734
9101
|
fallback: 0
|
|
8735
|
-
}), { width: a = 0 } = e, o =
|
|
9102
|
+
}), { width: a = 0 } = e, o = We({
|
|
8736
9103
|
value: n,
|
|
8737
9104
|
fallback: 0
|
|
8738
|
-
}), s =
|
|
9105
|
+
}), s = We({
|
|
8739
9106
|
value: a,
|
|
8740
9107
|
fallback: 0
|
|
8741
9108
|
});
|
|
@@ -9637,7 +10004,7 @@ var Xr = class {
|
|
|
9637
10004
|
target: n,
|
|
9638
10005
|
transform: i
|
|
9639
10006
|
}), !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: n });
|
|
9640
|
-
let a =
|
|
10007
|
+
let a = Ye({ object: n });
|
|
9641
10008
|
if (!a) {
|
|
9642
10009
|
this._clearSpacingContexts(), this._clearGuides();
|
|
9643
10010
|
return;
|
|
@@ -9652,7 +10019,7 @@ var Xr = class {
|
|
|
9652
10019
|
n.set({
|
|
9653
10020
|
left: e + l,
|
|
9654
10021
|
top: t + u
|
|
9655
|
-
}), n.setCoords(), a =
|
|
10022
|
+
}), n.setCoords(), a = Ye({ object: n }) ?? a;
|
|
9656
10023
|
}
|
|
9657
10024
|
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = Hi({
|
|
9658
10025
|
activeBounds: a,
|
|
@@ -9669,13 +10036,13 @@ var Xr = class {
|
|
|
9669
10036
|
n.set({
|
|
9670
10037
|
left: e + p.deltaX,
|
|
9671
10038
|
top: t + p.deltaY
|
|
9672
|
-
}), n.setCoords(), a =
|
|
10039
|
+
}), n.setCoords(), a = Ye({ object: n }) ?? a;
|
|
9673
10040
|
}
|
|
9674
10041
|
m || e._applyMovementStep({
|
|
9675
10042
|
target: n,
|
|
9676
10043
|
transform: i
|
|
9677
10044
|
});
|
|
9678
|
-
let h =
|
|
10045
|
+
let h = Ye({ object: n }) ?? a, g = zi({
|
|
9679
10046
|
activeBounds: h,
|
|
9680
10047
|
threshold: c,
|
|
9681
10048
|
anchors: this.anchors
|
|
@@ -9719,7 +10086,7 @@ var Xr = class {
|
|
|
9719
10086
|
}
|
|
9720
10087
|
let { anchors: l } = this, { vertical: u, horizontal: d } = l;
|
|
9721
10088
|
!u.length && !d.length && this._cacheAnchors({ activeObject: n });
|
|
9722
|
-
let f =
|
|
10089
|
+
let f = Ye({ object: n });
|
|
9723
10090
|
if (!f) {
|
|
9724
10091
|
this._clearGuides();
|
|
9725
10092
|
return;
|
|
@@ -9843,7 +10210,7 @@ var Xr = class {
|
|
|
9843
10210
|
}
|
|
9844
10211
|
let { anchors: a } = this, { vertical: o, horizontal: s } = a;
|
|
9845
10212
|
!o.length && !s.length && this._cacheAnchors({ activeObject: t });
|
|
9846
|
-
let c =
|
|
10213
|
+
let c = Ye({ object: t });
|
|
9847
10214
|
if (!c) {
|
|
9848
10215
|
this._clearGuides();
|
|
9849
10216
|
return;
|
|
@@ -10122,13 +10489,13 @@ var Xr = class {
|
|
|
10122
10489
|
horizontal: []
|
|
10123
10490
|
}, r = [];
|
|
10124
10491
|
for (let e of t) {
|
|
10125
|
-
let t =
|
|
10492
|
+
let t = Ye({ object: e });
|
|
10126
10493
|
t && (Ki({
|
|
10127
10494
|
anchors: n,
|
|
10128
10495
|
bounds: t
|
|
10129
10496
|
}), r.push(t));
|
|
10130
10497
|
}
|
|
10131
|
-
let { montageArea: i } = this.editor, a =
|
|
10498
|
+
let { montageArea: i } = this.editor, a = Ye({ object: i });
|
|
10132
10499
|
if (a) {
|
|
10133
10500
|
Ki({
|
|
10134
10501
|
anchors: n,
|
|
@@ -10156,7 +10523,7 @@ var Xr = class {
|
|
|
10156
10523
|
_resolveCurrentTargetBounds({ activeObject: e }) {
|
|
10157
10524
|
let t = this._collectTargets({ activeObject: e }), n = [];
|
|
10158
10525
|
for (let e of t) {
|
|
10159
|
-
let t =
|
|
10526
|
+
let t = Ye({ object: e });
|
|
10160
10527
|
t && n.push(t);
|
|
10161
10528
|
}
|
|
10162
10529
|
return n;
|
|
@@ -10234,7 +10601,7 @@ var Xr = class {
|
|
|
10234
10601
|
this._clearGuides();
|
|
10235
10602
|
return;
|
|
10236
10603
|
}
|
|
10237
|
-
let a =
|
|
10604
|
+
let a = Ye({ object: i });
|
|
10238
10605
|
if (!a) {
|
|
10239
10606
|
this._clearGuides();
|
|
10240
10607
|
return;
|
|
@@ -10242,7 +10609,7 @@ var Xr = class {
|
|
|
10242
10609
|
let o = e._resolveTarget({
|
|
10243
10610
|
event: t,
|
|
10244
10611
|
activeObject: i
|
|
10245
|
-
}), { montageArea: s } = r, c = o ?? s, l = c === s, u =
|
|
10612
|
+
}), { montageArea: s } = r, c = o ?? s, l = c === s, u = Ye({ object: c });
|
|
10246
10613
|
if (!u) {
|
|
10247
10614
|
this._clearGuides();
|
|
10248
10615
|
return;
|
|
@@ -10416,7 +10783,7 @@ var Xr = class {
|
|
|
10416
10783
|
}
|
|
10417
10784
|
async init() {
|
|
10418
10785
|
let { editorContainerWidth: e, editorContainerHeight: n, canvasWrapperWidth: r, canvasWrapperHeight: i, canvasCSSWidth: a, canvasCSSHeight: o, initialImage: s, initialState: c, scaleType: l, showRotationAngle: u, _onReadyCallback: d } = this.options;
|
|
10419
|
-
if (
|
|
10786
|
+
if (ie.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new gr({ editor: this }), this.historyManager = new je({ editor: this }), this.toolbar = new V({ editor: this }), this.transformManager = new He({ editor: this }), this.zoomManager = new Ue({ editor: this }), this.canvasManager = new Ve({ editor: this }), this.imageManager = new Le({ editor: this }), this.layerManager = new et({ editor: this }), this.shapeManager = new lr({ editor: this }), this.interactionBlocker = new Qe({ editor: this }), this.backgroundManager = new $e({ editor: this }), this.clipboardManager = new ur({ editor: this }), this.objectLockManager = new dr({ editor: this }), this.groupingManager = new fr({ editor: this }), this.selectionManager = new pr({ editor: this }), this.deletionManager = new mr({ editor: this }), this.panConstraintManager = new _r({ editor: this }), this.snappingManager = new Qi({ editor: this }), this.measurementManager = new ea({ editor: this }), this.fontManager = new z(this.options.fonts ?? []), this.textManager = new ai({ editor: this }), this.templateManager = new ui({ editor: this }), u && (this.angleIndicator = new ae({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
10420
10787
|
editor: this,
|
|
10421
10788
|
options: this.options
|
|
10422
10789
|
}), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(n), this.canvasManager.setCanvasWrapperWidth(r), this.canvasManager.setCanvasWrapperHeight(i), this.canvasManager.setCanvasCSSWidth(a), this.canvasManager.setCanvasCSSHeight(o), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), await this.fontManager.loadFonts(), c) {
|
|
@@ -10457,7 +10824,7 @@ var Xr = class {
|
|
|
10457
10824
|
}
|
|
10458
10825
|
_createMontageArea() {
|
|
10459
10826
|
let { montageAreaWidth: t, montageAreaHeight: n } = this.options, r = new p(t / 2, n / 2);
|
|
10460
|
-
this.montageArea =
|
|
10827
|
+
this.montageArea = Ze({
|
|
10461
10828
|
canvas: this.canvas,
|
|
10462
10829
|
centerPoint: r,
|
|
10463
10830
|
options: {
|
|
@@ -10481,7 +10848,7 @@ var Xr = class {
|
|
|
10481
10848
|
}
|
|
10482
10849
|
_createClippingArea() {
|
|
10483
10850
|
let { montageAreaWidth: e, montageAreaHeight: t } = this.options, n = new p(e / 2, t / 2);
|
|
10484
|
-
this.canvas.clipPath =
|
|
10851
|
+
this.canvas.clipPath = Ze({
|
|
10485
10852
|
canvas: this.canvas,
|
|
10486
10853
|
centerPoint: n,
|
|
10487
10854
|
options: {
|