@anu3ev/fabric-image-editor 0.5.18 → 0.5.20
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 +556 -485
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
var cs = Object.defineProperty, ds = Object.defineProperties;
|
|
2
2
|
var ls = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var Vt = Object.getOwnPropertySymbols;
|
|
4
4
|
var Re = Object.prototype.hasOwnProperty, _e = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var De = (h, t, e) => t in h ? cs(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, B = (h, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
7
|
Re.call(t, e) && De(h, e, t[e]);
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
8
|
+
if (Vt)
|
|
9
|
+
for (var e of Vt(t))
|
|
10
10
|
_e.call(t, e) && De(h, e, t[e]);
|
|
11
11
|
return h;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, bt = (h, t) => ds(h, ls(t));
|
|
13
|
+
var Mt = (h, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var s in h)
|
|
16
16
|
Re.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
|
|
17
|
-
if (h != null &&
|
|
18
|
-
for (var s of
|
|
17
|
+
if (h != null && Vt)
|
|
18
|
+
for (var s of Vt(h))
|
|
19
19
|
t.indexOf(s) < 0 && _e.call(h, s) && (e[s] = h[s]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
@@ -35,7 +35,7 @@ var k = (h, t, e) => new Promise((s, n) => {
|
|
|
35
35
|
}, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(o, i);
|
|
36
36
|
a((e = e.apply(h, t)).next());
|
|
37
37
|
});
|
|
38
|
-
import { ActiveSelection as U, Textbox as
|
|
38
|
+
import { ActiveSelection as U, Textbox as st, util as lt, controlsUtils as xe, InteractiveFabricObject as Ne, Point as tt, FitContentLayout as Be, loadSVGFromURL as hs, FabricImage as zt, Gradient as ke, Rect as us, Circle as fs, Triangle as gs, Group as Et, Color as ps, classRegistry as ze, loadSVGFromString as ms, Canvas as ys, Pattern as vs } from "fabric";
|
|
39
39
|
import { create as bs } from "jsondiffpatch";
|
|
40
40
|
import Ms from "diff-match-patch";
|
|
41
41
|
var ws = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", V = function() {
|
|
@@ -215,20 +215,25 @@ class Ft {
|
|
|
215
215
|
* @param event.code — код клавиши
|
|
216
216
|
*/
|
|
217
217
|
handleSpaceKeyDown(t) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (
|
|
218
|
+
const { code: e } = t;
|
|
219
|
+
if (e !== "Space" || this._shouldIgnoreKeyboardEvent(t)) return;
|
|
220
|
+
if (this._isObjectTransforming()) {
|
|
221
|
+
t.preventDefault();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const { canvas: s, editor: n, isSpacePressed: o, isDragging: i } = this;
|
|
225
|
+
if (o || i) return;
|
|
221
226
|
this.isSpacePressed = !0, t.preventDefault();
|
|
222
|
-
const
|
|
223
|
-
|
|
227
|
+
const a = s.getActiveObject() || null;
|
|
228
|
+
a instanceof U ? this.savedSelection = a.getObjects().slice() : a && (this.savedSelection = [a]), s.discardActiveObject(), s.set({
|
|
224
229
|
selection: !1,
|
|
225
230
|
defaultCursor: "grab"
|
|
226
|
-
}),
|
|
227
|
-
|
|
231
|
+
}), s.setCursor("grab"), n.canvasManager.getObjects().forEach((r) => {
|
|
232
|
+
r.set({
|
|
228
233
|
selectable: !1,
|
|
229
234
|
evented: !1
|
|
230
235
|
});
|
|
231
|
-
}),
|
|
236
|
+
}), s.requestRenderAll();
|
|
232
237
|
}
|
|
233
238
|
/**
|
|
234
239
|
* Обработчик для отпускания пробела.
|
|
@@ -238,11 +243,12 @@ class Ft {
|
|
|
238
243
|
* @param event.code — код клавиши
|
|
239
244
|
*/
|
|
240
245
|
handleSpaceKeyUp(t) {
|
|
241
|
-
|
|
246
|
+
const { code: e } = t;
|
|
247
|
+
e !== "Space" || this._shouldIgnoreKeyboardEvent(t) || this.isSpacePressed && (this.isSpacePressed = !1, this.isDragging && this.handleCanvasDragEnd(), this.canvas.set({
|
|
242
248
|
defaultCursor: "default",
|
|
243
249
|
selection: !0
|
|
244
|
-
}), this.canvas.setCursor("default"), this.editor.canvasManager.getObjects().forEach((
|
|
245
|
-
|
|
250
|
+
}), this.canvas.setCursor("default"), this.editor.canvasManager.getObjects().forEach((s) => {
|
|
251
|
+
s.set({
|
|
246
252
|
selectable: !0,
|
|
247
253
|
evented: !0
|
|
248
254
|
});
|
|
@@ -260,7 +266,18 @@ class Ft {
|
|
|
260
266
|
return;
|
|
261
267
|
}
|
|
262
268
|
const n = t.filter((i) => s.canvasManager.getObjects().includes(i)), o = new U(n, { canvas: e });
|
|
263
|
-
|
|
269
|
+
n.some((i) => i.locked) && s.objectLockManager.lockObject({
|
|
270
|
+
object: o,
|
|
271
|
+
skipInnerObjects: !0,
|
|
272
|
+
withoutSave: !0
|
|
273
|
+
}), e.setActiveObject(o);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Проверяет, идет ли трансформация объекта на канвасе прямо сейчас.
|
|
277
|
+
*/
|
|
278
|
+
_isObjectTransforming() {
|
|
279
|
+
const { canvas: t } = this, { _currentTransform: e } = t;
|
|
280
|
+
return !!e;
|
|
264
281
|
}
|
|
265
282
|
// --- Обработчики для событий canvas (Fabric) ---
|
|
266
283
|
/**
|
|
@@ -330,7 +347,7 @@ class Ft {
|
|
|
330
347
|
*/
|
|
331
348
|
handleResetObjectFit(t) {
|
|
332
349
|
const e = t == null ? void 0 : t.target;
|
|
333
|
-
!e || e instanceof
|
|
350
|
+
!e || e instanceof st || this.editor.transformManager.resetObject({ object: e });
|
|
334
351
|
}
|
|
335
352
|
/**
|
|
336
353
|
* Проверяет, должно ли событие клавиатуры быть проигнорировано
|
|
@@ -463,81 +480,81 @@ class js {
|
|
|
463
480
|
this.worker.terminate();
|
|
464
481
|
}
|
|
465
482
|
}
|
|
466
|
-
const
|
|
467
|
-
function
|
|
468
|
-
const o =
|
|
469
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
483
|
+
const ct = 12, Is = 2, le = 8, he = 20, Cs = 100, ue = 20, fe = 8, Ts = 100, $t = 32, ye = 1, Es = "#2B2D33", ve = "#3D8BF4", be = "#FFFFFF";
|
|
484
|
+
function Xt(h, t, e, s, n) {
|
|
485
|
+
const o = ct, i = Is;
|
|
486
|
+
h.save(), h.translate(t, e), h.rotate(lt.degreesToRadians(n.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
|
|
470
487
|
}
|
|
471
488
|
function Ue(h, t, e, s, n) {
|
|
472
|
-
const o =
|
|
473
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
489
|
+
const o = le, i = he, a = Cs;
|
|
490
|
+
h.save(), h.translate(t, e), h.rotate(lt.degreesToRadians(n.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
|
|
474
491
|
}
|
|
475
492
|
function Pe(h, t, e, s, n) {
|
|
476
|
-
const o =
|
|
477
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
493
|
+
const o = ue, i = fe, a = Ts;
|
|
494
|
+
h.save(), h.translate(t, e), h.rotate(lt.degreesToRadians(n.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
|
|
478
495
|
}
|
|
479
496
|
const Os = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ts = new Image();
|
|
480
497
|
ts.src = Os;
|
|
481
498
|
function Ls(h, t, e, s, n) {
|
|
482
|
-
const i =
|
|
483
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
499
|
+
const i = $t / 2;
|
|
500
|
+
h.save(), h.translate(t, e), h.rotate(lt.degreesToRadians(n.angle)), h.fillStyle = Es, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(ts, -i / 2, -i / 2, i, i), h.restore();
|
|
484
501
|
}
|
|
485
502
|
const Ds = {
|
|
486
503
|
// Угловые точки
|
|
487
504
|
tl: {
|
|
488
|
-
render:
|
|
489
|
-
sizeX:
|
|
490
|
-
sizeY:
|
|
505
|
+
render: Xt,
|
|
506
|
+
sizeX: ct,
|
|
507
|
+
sizeY: ct,
|
|
491
508
|
offsetX: 0,
|
|
492
509
|
offsetY: 0
|
|
493
510
|
},
|
|
494
511
|
tr: {
|
|
495
|
-
render:
|
|
496
|
-
sizeX:
|
|
497
|
-
sizeY:
|
|
512
|
+
render: Xt,
|
|
513
|
+
sizeX: ct,
|
|
514
|
+
sizeY: ct,
|
|
498
515
|
offsetX: 0,
|
|
499
516
|
offsetY: 0
|
|
500
517
|
},
|
|
501
518
|
bl: {
|
|
502
|
-
render:
|
|
503
|
-
sizeX:
|
|
504
|
-
sizeY:
|
|
519
|
+
render: Xt,
|
|
520
|
+
sizeX: ct,
|
|
521
|
+
sizeY: ct,
|
|
505
522
|
offsetX: 0,
|
|
506
523
|
offsetY: 0
|
|
507
524
|
},
|
|
508
525
|
br: {
|
|
509
|
-
render:
|
|
510
|
-
sizeX:
|
|
511
|
-
sizeY:
|
|
526
|
+
render: Xt,
|
|
527
|
+
sizeX: ct,
|
|
528
|
+
sizeY: ct,
|
|
512
529
|
offsetX: 0,
|
|
513
530
|
offsetY: 0
|
|
514
531
|
},
|
|
515
532
|
// Середина вертикалей
|
|
516
533
|
ml: {
|
|
517
534
|
render: Ue,
|
|
518
|
-
sizeX:
|
|
519
|
-
sizeY:
|
|
535
|
+
sizeX: le,
|
|
536
|
+
sizeY: he,
|
|
520
537
|
offsetX: 0,
|
|
521
538
|
offsetY: 0
|
|
522
539
|
},
|
|
523
540
|
mr: {
|
|
524
541
|
render: Ue,
|
|
525
|
-
sizeX:
|
|
526
|
-
sizeY:
|
|
542
|
+
sizeX: le,
|
|
543
|
+
sizeY: he,
|
|
527
544
|
offsetX: 0,
|
|
528
545
|
offsetY: 0
|
|
529
546
|
},
|
|
530
547
|
// Середина горизонталей
|
|
531
548
|
mt: {
|
|
532
549
|
render: Pe,
|
|
533
|
-
sizeX:
|
|
550
|
+
sizeX: ue,
|
|
534
551
|
sizeY: fe,
|
|
535
552
|
offsetX: 0,
|
|
536
553
|
offsetY: 0
|
|
537
554
|
},
|
|
538
555
|
mb: {
|
|
539
556
|
render: Pe,
|
|
540
|
-
sizeX:
|
|
557
|
+
sizeX: ue,
|
|
541
558
|
sizeY: fe,
|
|
542
559
|
offsetX: 0,
|
|
543
560
|
offsetY: 0
|
|
@@ -545,10 +562,10 @@ const Ds = {
|
|
|
545
562
|
// Специальный «rotate» контрол
|
|
546
563
|
mtr: {
|
|
547
564
|
render: Ls,
|
|
548
|
-
sizeX:
|
|
549
|
-
sizeY:
|
|
565
|
+
sizeX: $t,
|
|
566
|
+
sizeY: $t,
|
|
550
567
|
offsetX: 0,
|
|
551
|
-
offsetY:
|
|
568
|
+
offsetY: -$t
|
|
552
569
|
}
|
|
553
570
|
};
|
|
554
571
|
class $ {
|
|
@@ -583,7 +600,7 @@ class $ {
|
|
|
583
600
|
const t = xe.createObjectDefaultControls();
|
|
584
601
|
$.applyControlOverrides(t), Ne.ownDefaults.controls = t;
|
|
585
602
|
const e = xe.createTextboxDefaultControls();
|
|
586
|
-
$.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), $.wrapWidthControl(e.ml), $.wrapWidthControl(e.mr),
|
|
603
|
+
$.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), $.wrapWidthControl(e.ml), $.wrapWidthControl(e.mr), st.ownDefaults.controls = e, $.patchActiveSelectionBounds(), Ne.ownDefaults.snapAngle = 1;
|
|
587
604
|
}
|
|
588
605
|
/**
|
|
589
606
|
* Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
|
|
@@ -591,8 +608,8 @@ class $ {
|
|
|
591
608
|
static patchActiveSelectionBounds() {
|
|
592
609
|
const t = U.prototype, e = t._calcBoundsFromObjects;
|
|
593
610
|
t._calcBoundsFromObjects = function(...o) {
|
|
594
|
-
var
|
|
595
|
-
const i = (
|
|
611
|
+
var f, g;
|
|
612
|
+
const i = (g = (f = this.getObjects) == null ? void 0 : f.call(this)) != null ? g : [];
|
|
596
613
|
$.applyTextSelectionScalingLock({
|
|
597
614
|
selection: this,
|
|
598
615
|
objects: i
|
|
@@ -609,7 +626,7 @@ class $ {
|
|
|
609
626
|
width: d,
|
|
610
627
|
height: l
|
|
611
628
|
});
|
|
612
|
-
const u = new
|
|
629
|
+
const u = new tt(r + d / 2, c + l / 2);
|
|
613
630
|
return this.setPositionByOrigin(u, "center", "center"), a;
|
|
614
631
|
};
|
|
615
632
|
const s = t._onAfterObjectsChange;
|
|
@@ -624,11 +641,11 @@ class $ {
|
|
|
624
641
|
objects: r
|
|
625
642
|
});
|
|
626
643
|
if (!c) return a;
|
|
627
|
-
const { left: d, top: l, width: u, height:
|
|
644
|
+
const { left: d, top: l, width: u, height: f } = c, g = new tt(d + u / 2, l + f / 2);
|
|
628
645
|
return this.set({
|
|
629
646
|
width: u,
|
|
630
|
-
height:
|
|
631
|
-
}), this.setPositionByOrigin(
|
|
647
|
+
height: f
|
|
648
|
+
}), this.setPositionByOrigin(g, "center", "center"), this.setCoords(), a;
|
|
632
649
|
};
|
|
633
650
|
const n = Be.prototype.calcBoundingBox;
|
|
634
651
|
Be.prototype.calcBoundingBox = function(o, i) {
|
|
@@ -644,10 +661,10 @@ class $ {
|
|
|
644
661
|
const d = $.calculateActiveSelectionBounds({ objects: o });
|
|
645
662
|
if (!d)
|
|
646
663
|
return n.call(this, o, i);
|
|
647
|
-
const { left: l, top: u, width:
|
|
664
|
+
const { left: l, top: u, width: f, height: g } = d, p = new tt(f, g), m = new tt(l + f / 2, u + g / 2);
|
|
648
665
|
return r === "initialization" ? {
|
|
649
666
|
center: m,
|
|
650
|
-
relativeCorrection: new
|
|
667
|
+
relativeCorrection: new tt(0, 0),
|
|
651
668
|
size: p
|
|
652
669
|
} : {
|
|
653
670
|
center: m,
|
|
@@ -677,7 +694,7 @@ class $ {
|
|
|
677
694
|
selection: t,
|
|
678
695
|
objects: e
|
|
679
696
|
}) {
|
|
680
|
-
const s = e.some((n) => n instanceof
|
|
697
|
+
const s = e.some((n) => n instanceof st);
|
|
681
698
|
t.setControlsVisibility({
|
|
682
699
|
mt: !s,
|
|
683
700
|
mb: !s,
|
|
@@ -854,8 +871,8 @@ z.registeredFontKeys = /* @__PURE__ */ new Set(), z.descriptorDefaults = {
|
|
|
854
871
|
featureSettings: "normal",
|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1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", Us = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0VDNEU0MCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xMjUgMS4yNUExLjg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Ut = {
|
|
859
876
|
style: {
|
|
860
877
|
position: "absolute",
|
|
861
878
|
display: "none",
|
|
@@ -965,11 +982,11 @@ class Ps {
|
|
|
965
982
|
_initToolbar() {
|
|
966
983
|
if (!this.options.showToolbar) return;
|
|
967
984
|
const t = this.options.toolbar || {};
|
|
968
|
-
this.config =
|
|
969
|
-
style: B(B({},
|
|
970
|
-
btnStyle: B(B({},
|
|
971
|
-
icons: B(B({},
|
|
972
|
-
handlers: B(B({},
|
|
985
|
+
this.config = bt(B(B({}, Ut), t), {
|
|
986
|
+
style: B(B({}, Ut.style), t.style || {}),
|
|
987
|
+
btnStyle: B(B({}, Ut.btnStyle), t.btnStyle || {}),
|
|
988
|
+
icons: B(B({}, Ut.icons), t.icons || {}),
|
|
989
|
+
handlers: B(B({}, Ut.handlers), t.handlers || {})
|
|
973
990
|
}), 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 = () => {
|
|
974
991
|
this.el.style.display = "none";
|
|
975
992
|
}, this._createDOM(), this._bindEvents();
|
|
@@ -1072,10 +1089,10 @@ class Ps {
|
|
|
1072
1089
|
}
|
|
1073
1090
|
const { el: e, config: s, canvas: n } = this;
|
|
1074
1091
|
t.setCoords();
|
|
1075
|
-
const o = n.getZoom(), [, , , , i, a] = n.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: d } = t.getBoundingRect(), u = r * o + i - e.offsetWidth / 2,
|
|
1092
|
+
const o = n.getZoom(), [, , , , i, a] = n.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: d } = t.getBoundingRect(), u = r * o + i - e.offsetWidth / 2, f = s.offsetTop || 0, g = (c + d) * o + a + f;
|
|
1076
1093
|
Object.assign(e.style, {
|
|
1077
1094
|
left: `${u}px`,
|
|
1078
|
-
top: `${
|
|
1095
|
+
top: `${g}px`,
|
|
1079
1096
|
display: "flex"
|
|
1080
1097
|
});
|
|
1081
1098
|
}
|
|
@@ -1086,7 +1103,7 @@ class Ps {
|
|
|
1086
1103
|
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();
|
|
1087
1104
|
}
|
|
1088
1105
|
}
|
|
1089
|
-
const
|
|
1106
|
+
const Fs = {
|
|
1090
1107
|
position: "absolute",
|
|
1091
1108
|
display: "none",
|
|
1092
1109
|
background: "#2B2D33",
|
|
@@ -1100,8 +1117,8 @@ const Ws = {
|
|
|
1100
1117
|
"pointer-events": "none",
|
|
1101
1118
|
"white-space": "nowrap",
|
|
1102
1119
|
"box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
|
|
1103
|
-
},
|
|
1104
|
-
class
|
|
1120
|
+
}, Fe = 16, We = 16, Ws = "fabric-editor-angle-indicator";
|
|
1121
|
+
class Me {
|
|
1105
1122
|
constructor({ editor: t }) {
|
|
1106
1123
|
this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
|
|
1107
1124
|
}
|
|
@@ -1109,7 +1126,7 @@ class we {
|
|
|
1109
1126
|
* Создание DOM-элемента индикатора
|
|
1110
1127
|
*/
|
|
1111
1128
|
_createDOM() {
|
|
1112
|
-
this.el = document.createElement("div"), this.el.className =
|
|
1129
|
+
this.el = document.createElement("div"), this.el.className = Ws, Object.entries(Fs).forEach(([t, e]) => {
|
|
1113
1130
|
this.el.style.setProperty(t, e);
|
|
1114
1131
|
}), this.canvas.wrapperEl.appendChild(this.el);
|
|
1115
1132
|
}
|
|
@@ -1129,7 +1146,7 @@ class we {
|
|
|
1129
1146
|
return;
|
|
1130
1147
|
}
|
|
1131
1148
|
const s = e.angle || 0;
|
|
1132
|
-
this.currentAngle =
|
|
1149
|
+
this.currentAngle = Me._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
|
|
1133
1150
|
}
|
|
1134
1151
|
/**
|
|
1135
1152
|
* Обработчик отпускания кнопки мыши
|
|
@@ -1160,9 +1177,9 @@ class we {
|
|
|
1160
1177
|
*/
|
|
1161
1178
|
_positionIndicator(t) {
|
|
1162
1179
|
const e = this.canvas.wrapperEl.getBoundingClientRect();
|
|
1163
|
-
let s = t.clientX - e.left +
|
|
1180
|
+
let s = t.clientX - e.left + Fe, n = t.clientY - e.top + We;
|
|
1164
1181
|
const o = this.el.getBoundingClientRect(), i = o.width, a = o.height;
|
|
1165
|
-
s + i > e.width && (s = t.clientX - e.left - i -
|
|
1182
|
+
s + i > e.width && (s = t.clientX - e.left - i - Fe), n + a > e.height && (n = t.clientY - e.top - a - We), this.el.style.left = `${s}px`, this.el.style.top = `${n}px`;
|
|
1166
1183
|
}
|
|
1167
1184
|
/**
|
|
1168
1185
|
* Показать индикатор
|
|
@@ -1204,6 +1221,7 @@ const es = [
|
|
|
1204
1221
|
"width",
|
|
1205
1222
|
"height",
|
|
1206
1223
|
"locked",
|
|
1224
|
+
"editable",
|
|
1207
1225
|
"lockMovementX",
|
|
1208
1226
|
"lockMovementY",
|
|
1209
1227
|
"lockRotation",
|
|
@@ -1473,7 +1491,7 @@ class Ys {
|
|
|
1473
1491
|
}
|
|
1474
1492
|
}
|
|
1475
1493
|
}
|
|
1476
|
-
const Hs = 0.1, Zs = 2, Ye = 0.1, Gs = 90, Rt = 16, _t = 16,
|
|
1494
|
+
const Hs = 0.1, Zs = 2, Ye = 0.1, Gs = 90, Rt = 16, _t = 16, St = 4096, At = 4096, He = "application/image-editor:", Kt = [
|
|
1477
1495
|
"format",
|
|
1478
1496
|
"uppercase",
|
|
1479
1497
|
"textCaseRaw",
|
|
@@ -1488,7 +1506,7 @@ const Hs = 0.1, Zs = 2, Ye = 0.1, Gs = 90, Rt = 16, _t = 16, wt = 4096, St = 409
|
|
|
1488
1506
|
"radiusBottomRight",
|
|
1489
1507
|
"radiusBottomLeft"
|
|
1490
1508
|
], Vs = 50;
|
|
1491
|
-
class
|
|
1509
|
+
class dt {
|
|
1492
1510
|
constructor({ editor: t }) {
|
|
1493
1511
|
this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
|
|
1494
1512
|
}
|
|
@@ -1516,10 +1534,10 @@ class ct {
|
|
|
1516
1534
|
withoutAdding: r = !1
|
|
1517
1535
|
} = t;
|
|
1518
1536
|
if (!e) return null;
|
|
1519
|
-
const { canvas: c, montageArea: d, transformManager: l, historyManager: u, errorManager:
|
|
1520
|
-
if (!this.isAllowedContentType(
|
|
1521
|
-
const M = `Неверный contentType для изображения: ${
|
|
1522
|
-
return
|
|
1537
|
+
const { canvas: c, montageArea: d, transformManager: l, historyManager: u, errorManager: f } = this.editor, g = yield this.getContentType(e), p = dt.getFormatFromContentType(g), { acceptContentTypes: m, acceptFormats: v } = this;
|
|
1538
|
+
if (!this.isAllowedContentType(g)) {
|
|
1539
|
+
const M = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
|
|
1540
|
+
return f.emitError({
|
|
1523
1541
|
origin: "ImageManager",
|
|
1524
1542
|
method: "importImage",
|
|
1525
1543
|
code: "INVALID_CONTENT_TYPE",
|
|
@@ -1527,7 +1545,7 @@ class ct {
|
|
|
1527
1545
|
data: {
|
|
1528
1546
|
source: e,
|
|
1529
1547
|
format: p,
|
|
1530
|
-
contentType:
|
|
1548
|
+
contentType: g,
|
|
1531
1549
|
acceptContentTypes: m,
|
|
1532
1550
|
acceptFormats: v,
|
|
1533
1551
|
fromClipboard: o,
|
|
@@ -1546,7 +1564,7 @@ class ct {
|
|
|
1546
1564
|
const A = yield (yield fetch(e, { mode: "cors" })).blob();
|
|
1547
1565
|
M = URL.createObjectURL(A);
|
|
1548
1566
|
} else
|
|
1549
|
-
return
|
|
1567
|
+
return f.emitError({
|
|
1550
1568
|
origin: "ImageManager",
|
|
1551
1569
|
method: "importImage",
|
|
1552
1570
|
code: "INVALID_SOURCE_TYPE",
|
|
@@ -1554,7 +1572,7 @@ class ct {
|
|
|
1554
1572
|
data: {
|
|
1555
1573
|
source: e,
|
|
1556
1574
|
format: p,
|
|
1557
|
-
contentType:
|
|
1575
|
+
contentType: g,
|
|
1558
1576
|
acceptContentTypes: m,
|
|
1559
1577
|
acceptFormats: v,
|
|
1560
1578
|
fromClipboard: o,
|
|
@@ -1565,19 +1583,19 @@ class ct {
|
|
|
1565
1583
|
}), null;
|
|
1566
1584
|
if (this._createdBlobUrls.push(M), p === "svg") {
|
|
1567
1585
|
const j = yield hs(M);
|
|
1568
|
-
S =
|
|
1586
|
+
S = lt.groupSVGElements(j.objects, j.options);
|
|
1569
1587
|
} else
|
|
1570
|
-
S = yield
|
|
1588
|
+
S = yield zt.fromURL(M, { crossOrigin: "anonymous" });
|
|
1571
1589
|
const { width: y, height: b } = S;
|
|
1572
|
-
if (S instanceof
|
|
1590
|
+
if (S instanceof zt) {
|
|
1573
1591
|
const j = S.getElement();
|
|
1574
1592
|
let A = "";
|
|
1575
|
-
if (j instanceof HTMLImageElement ? A = j.src : j instanceof HTMLCanvasElement && (A = j.toDataURL()), b >
|
|
1593
|
+
if (j instanceof HTMLImageElement ? A = j.src : j instanceof HTMLCanvasElement && (A = j.toDataURL()), b > At || y > St) {
|
|
1576
1594
|
const C = yield this.resizeImageToBoundaries(A, "max"), w = URL.createObjectURL(C);
|
|
1577
|
-
this._createdBlobUrls.push(w), S = yield
|
|
1595
|
+
this._createdBlobUrls.push(w), S = yield zt.fromURL(w, { crossOrigin: "anonymous" });
|
|
1578
1596
|
} else if (b < _t || y < Rt) {
|
|
1579
1597
|
const C = yield this.resizeImageToBoundaries(A, "min"), w = URL.createObjectURL(C);
|
|
1580
|
-
this._createdBlobUrls.push(w), S = yield
|
|
1598
|
+
this._createdBlobUrls.push(w), S = yield zt.fromURL(w, { crossOrigin: "anonymous" });
|
|
1581
1599
|
}
|
|
1582
1600
|
}
|
|
1583
1601
|
if (S.set("id", `${S.type}-${V()}`), S.set("format", p), s === "scale-montage")
|
|
@@ -1589,7 +1607,7 @@ class ct {
|
|
|
1589
1607
|
const I = {
|
|
1590
1608
|
image: S,
|
|
1591
1609
|
format: p,
|
|
1592
|
-
contentType:
|
|
1610
|
+
contentType: g,
|
|
1593
1611
|
scale: s,
|
|
1594
1612
|
withoutSave: n,
|
|
1595
1613
|
source: e,
|
|
@@ -1600,7 +1618,7 @@ class ct {
|
|
|
1600
1618
|
};
|
|
1601
1619
|
return r ? (u.resumeHistory(), c.fire("editor:image-imported", I), I) : (c.add(S), c.centerObject(S), a || c.setActiveObject(S), c.renderAll(), u.resumeHistory(), n || u.saveState(), c.fire("editor:image-imported", I), I);
|
|
1602
1620
|
} catch (M) {
|
|
1603
|
-
return
|
|
1621
|
+
return f.emitError({
|
|
1604
1622
|
origin: "ImageManager",
|
|
1605
1623
|
method: "importImage",
|
|
1606
1624
|
code: "IMPORT_FAILED",
|
|
@@ -1608,7 +1626,7 @@ class ct {
|
|
|
1608
1626
|
data: {
|
|
1609
1627
|
source: e,
|
|
1610
1628
|
format: p,
|
|
1611
|
-
contentType:
|
|
1629
|
+
contentType: g,
|
|
1612
1630
|
scale: s,
|
|
1613
1631
|
withoutSave: n,
|
|
1614
1632
|
fromClipboard: o,
|
|
@@ -1630,13 +1648,13 @@ class ct {
|
|
|
1630
1648
|
*/
|
|
1631
1649
|
resizeImageToBoundaries(t, e = "max") {
|
|
1632
1650
|
return k(this, null, function* () {
|
|
1633
|
-
let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${
|
|
1651
|
+
let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${St}x${At}`;
|
|
1634
1652
|
e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Rt}x${_t}`);
|
|
1635
1653
|
const n = {
|
|
1636
1654
|
dataURL: t,
|
|
1637
1655
|
sizeType: e,
|
|
1638
|
-
maxWidth:
|
|
1639
|
-
maxHeight:
|
|
1656
|
+
maxWidth: St,
|
|
1657
|
+
maxHeight: At,
|
|
1640
1658
|
minWidth: Rt,
|
|
1641
1659
|
minHeight: _t
|
|
1642
1660
|
};
|
|
@@ -1669,22 +1687,22 @@ class ct {
|
|
|
1669
1687
|
exportAsBlob: o = !1
|
|
1670
1688
|
} = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
|
|
1671
1689
|
try {
|
|
1672
|
-
const d = s === "application/pdf", l = d ? "image/jpg" : s, u =
|
|
1690
|
+
const d = s === "application/pdf", l = d ? "image/jpg" : s, u = dt.getFormatFromContentType(l);
|
|
1673
1691
|
a.setCoords();
|
|
1674
|
-
const { left:
|
|
1692
|
+
const { left: f, top: g, width: p, height: m } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
|
|
1675
1693
|
v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
|
|
1676
1694
|
const M = v.getObjects().find((w) => w.id === a.id);
|
|
1677
1695
|
if (M && (M.visible = !1), c != null && c.isBlocked) {
|
|
1678
1696
|
const w = v.getObjects().find((T) => T.id === c.overlayMask.id);
|
|
1679
1697
|
w && (w.visible = !1);
|
|
1680
1698
|
}
|
|
1681
|
-
v.viewportTransform = [1, 0, 0, 1, -
|
|
1699
|
+
v.viewportTransform = [1, 0, 0, 1, -f, -g], v.setDimensions({ width: p, height: m }, { backstoreOnly: !0 }), v.renderAll();
|
|
1682
1700
|
const S = v.getObjects().filter((w) => w.format).every((w) => w.format === "svg");
|
|
1683
1701
|
if (u === "svg" && S) {
|
|
1684
1702
|
const w = v.toSVG();
|
|
1685
1703
|
v.dispose();
|
|
1686
1704
|
const E = {
|
|
1687
|
-
image:
|
|
1705
|
+
image: dt._exportSVGStringAsFile(w, {
|
|
1688
1706
|
exportAsBase64: n,
|
|
1689
1707
|
exportAsBlob: o,
|
|
1690
1708
|
fileName: e
|
|
@@ -1715,19 +1733,19 @@ class ct {
|
|
|
1715
1733
|
[b]
|
|
1716
1734
|
);
|
|
1717
1735
|
if (d) {
|
|
1718
|
-
const T = p * 0.264583, E = m * 0.264583,
|
|
1736
|
+
const T = p * 0.264583, E = m * 0.264583, F = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, x = new F({
|
|
1719
1737
|
orientation: T > E ? "landscape" : "portrait",
|
|
1720
1738
|
unit: "mm",
|
|
1721
1739
|
format: [T, E]
|
|
1722
1740
|
});
|
|
1723
1741
|
if (x.addImage(String(I), "JPG", 0, 0, T, E), n) {
|
|
1724
|
-
const
|
|
1742
|
+
const W = {
|
|
1725
1743
|
image: x.output("datauristring"),
|
|
1726
1744
|
format: "pdf",
|
|
1727
1745
|
contentType: "application/pdf",
|
|
1728
1746
|
fileName: e
|
|
1729
1747
|
};
|
|
1730
|
-
return i.fire("editor:canvas-exported",
|
|
1748
|
+
return i.fire("editor:canvas-exported", W), W;
|
|
1731
1749
|
}
|
|
1732
1750
|
const N = x.output("blob"), D = {
|
|
1733
1751
|
image: new File([N], e, { type: "application/pdf" }),
|
|
@@ -1793,9 +1811,9 @@ class ct {
|
|
|
1793
1811
|
data: { contentType: n, fileName: s, exportAsBase64: o, exportAsBlob: i }
|
|
1794
1812
|
}), null;
|
|
1795
1813
|
try {
|
|
1796
|
-
const d =
|
|
1814
|
+
const d = dt.getFormatFromContentType(n);
|
|
1797
1815
|
if (d === "svg") {
|
|
1798
|
-
const p = c.toSVG(), m =
|
|
1816
|
+
const p = c.toSVG(), m = dt._exportSVGStringAsFile(p, {
|
|
1799
1817
|
exportAsBase64: o,
|
|
1800
1818
|
exportAsBlob: i,
|
|
1801
1819
|
fileName: s
|
|
@@ -1808,7 +1826,7 @@ class ct {
|
|
|
1808
1826
|
};
|
|
1809
1827
|
return a.fire("editor:object-exported", v), v;
|
|
1810
1828
|
}
|
|
1811
|
-
if (o && c instanceof
|
|
1829
|
+
if (o && c instanceof zt) {
|
|
1812
1830
|
const p = yield createImageBitmap(c.getElement()), m = yield r.post(
|
|
1813
1831
|
"toDataURL",
|
|
1814
1832
|
{
|
|
@@ -1843,14 +1861,14 @@ class ct {
|
|
|
1843
1861
|
};
|
|
1844
1862
|
return a.fire("editor:object-exported", p), p;
|
|
1845
1863
|
}
|
|
1846
|
-
const
|
|
1864
|
+
const f = new File([u], s, { type: n }), g = {
|
|
1847
1865
|
object: c,
|
|
1848
|
-
image:
|
|
1866
|
+
image: f,
|
|
1849
1867
|
format: d,
|
|
1850
1868
|
contentType: n,
|
|
1851
1869
|
fileName: s
|
|
1852
1870
|
};
|
|
1853
|
-
return a.fire("editor:object-exported",
|
|
1871
|
+
return a.fire("editor:object-exported", g), g;
|
|
1854
1872
|
} catch (d) {
|
|
1855
1873
|
return this.editor.errorManager.emitError({
|
|
1856
1874
|
origin: "ImageManager",
|
|
@@ -1873,7 +1891,7 @@ class ct {
|
|
|
1873
1891
|
* @returns массив допустимых форматов изображений
|
|
1874
1892
|
*/
|
|
1875
1893
|
getAllowedFormatsFromContentTypes() {
|
|
1876
|
-
return this.acceptContentTypes.map((t) =>
|
|
1894
|
+
return this.acceptContentTypes.map((t) => dt.getFormatFromContentType(t)).filter((t) => t);
|
|
1877
1895
|
}
|
|
1878
1896
|
/**
|
|
1879
1897
|
* Проверяет, является ли contentType допустимым типом изображения.
|
|
@@ -1926,7 +1944,7 @@ class ct {
|
|
|
1926
1944
|
try {
|
|
1927
1945
|
const n = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), o = {};
|
|
1928
1946
|
return this.acceptContentTypes.forEach((i) => {
|
|
1929
|
-
const a =
|
|
1947
|
+
const a = dt.getFormatFromContentType(i);
|
|
1930
1948
|
a && (o[a] = i);
|
|
1931
1949
|
}), n && o[n] || "application/octet-stream";
|
|
1932
1950
|
} catch (s) {
|
|
@@ -1979,7 +1997,7 @@ class ct {
|
|
|
1979
1997
|
return e ? e[1] : "";
|
|
1980
1998
|
}
|
|
1981
1999
|
}
|
|
1982
|
-
const
|
|
2000
|
+
const gt = (h, t, e) => Math.max(Math.min(h, e), t), Ze = (h, t) => h * t, Xs = (h, t) => new tt(h / 2, t / 2);
|
|
1983
2001
|
function Ks(h) {
|
|
1984
2002
|
return ((h == null ? void 0 : h.type) === "image" || (h == null ? void 0 : h.format) === "svg") && typeof (h == null ? void 0 : h.width) == "number" && typeof (h == null ? void 0 : h.height) == "number";
|
|
1985
2003
|
}
|
|
@@ -1998,6 +2016,22 @@ class Qs {
|
|
|
1998
2016
|
const { canvas: t, options: { editorContainer: e } } = this.editor;
|
|
1999
2017
|
return t.editorContainer || e;
|
|
2000
2018
|
}
|
|
2019
|
+
/**
|
|
2020
|
+
* Возвращает центральную точку текущей видимой области канваса.
|
|
2021
|
+
* Если точка находится за пределами монтажной области, она проецируется на ближайшую границу монтажной области.
|
|
2022
|
+
*/
|
|
2023
|
+
getVisibleCenterPoint() {
|
|
2024
|
+
const { canvas: t, montageArea: e } = this.editor, s = t.getZoom(), n = t.viewportTransform, o = t.getWidth(), i = t.getHeight(), a = (o / 2 - n[4]) / s, r = (i / 2 - n[5]) / s, c = e.width / 2, d = e.height / 2, l = gt(
|
|
2025
|
+
a,
|
|
2026
|
+
e.left - c,
|
|
2027
|
+
e.left + c
|
|
2028
|
+
), u = gt(
|
|
2029
|
+
r,
|
|
2030
|
+
e.top - d,
|
|
2031
|
+
e.top + d
|
|
2032
|
+
);
|
|
2033
|
+
return new tt(l, u);
|
|
2034
|
+
}
|
|
2001
2035
|
/**
|
|
2002
2036
|
* Устанавливаем внутреннюю ширину канваса (для экспорта)
|
|
2003
2037
|
* @param width - ширина канваса
|
|
@@ -2008,20 +2042,20 @@ class Qs {
|
|
|
2008
2042
|
* @fires editor:resolution-width-changed
|
|
2009
2043
|
*/
|
|
2010
2044
|
setResolutionWidth(t, { preserveProportional: e, withoutSave: s, adaptCanvasToContainer: n } = {}) {
|
|
2011
|
-
var
|
|
2045
|
+
var g;
|
|
2012
2046
|
if (!t) return;
|
|
2013
2047
|
const {
|
|
2014
2048
|
canvas: o,
|
|
2015
2049
|
montageArea: i,
|
|
2016
2050
|
options: { canvasBackstoreWidth: a }
|
|
2017
|
-
} = this.editor, { width: r, height: c } = i, d =
|
|
2018
|
-
if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (
|
|
2051
|
+
} = this.editor, { width: r, height: c } = i, d = gt(Number(t), Rt, St);
|
|
2052
|
+
if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (g = o.clipPath) == null || g.set({ width: d }), e) {
|
|
2019
2053
|
const p = d / r, m = Ze(c, p);
|
|
2020
2054
|
this.setResolutionHeight(m);
|
|
2021
2055
|
return;
|
|
2022
2056
|
}
|
|
2023
|
-
const { left: l, top: u } = this.getObjectDefaultCoords(i),
|
|
2024
|
-
o.setViewportTransform([
|
|
2057
|
+
const { left: l, top: u } = this.getObjectDefaultCoords(i), f = o.getZoom();
|
|
2058
|
+
o.setViewportTransform([f, 0, 0, f, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), o.fire("editor:resolution-width-changed", {
|
|
2025
2059
|
width: d,
|
|
2026
2060
|
preserveProportional: e,
|
|
2027
2061
|
withoutSave: s,
|
|
@@ -2038,20 +2072,20 @@ class Qs {
|
|
|
2038
2072
|
* @fires editor:resolution-height-changed
|
|
2039
2073
|
*/
|
|
2040
2074
|
setResolutionHeight(t, { preserveProportional: e, withoutSave: s, adaptCanvasToContainer: n } = {}) {
|
|
2041
|
-
var
|
|
2075
|
+
var g;
|
|
2042
2076
|
if (!t) return;
|
|
2043
2077
|
const {
|
|
2044
2078
|
canvas: o,
|
|
2045
2079
|
montageArea: i,
|
|
2046
2080
|
options: { canvasBackstoreHeight: a }
|
|
2047
|
-
} = this.editor, { width: r, height: c } = i, d =
|
|
2048
|
-
if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (
|
|
2081
|
+
} = this.editor, { width: r, height: c } = i, d = gt(Number(t), _t, At);
|
|
2082
|
+
if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (g = o.clipPath) == null || g.set({ height: d }), e) {
|
|
2049
2083
|
const p = d / c, m = Ze(r, p);
|
|
2050
2084
|
this.setResolutionWidth(m);
|
|
2051
2085
|
return;
|
|
2052
2086
|
}
|
|
2053
|
-
const { left: l, top: u } = this.getObjectDefaultCoords(i),
|
|
2054
|
-
o.setViewportTransform([
|
|
2087
|
+
const { left: l, top: u } = this.getObjectDefaultCoords(i), f = o.getZoom();
|
|
2088
|
+
o.setViewportTransform([f, 0, 0, f, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), o.fire("editor:resolution-height-changed", {
|
|
2055
2089
|
height: d,
|
|
2056
2090
|
preserveProportional: e,
|
|
2057
2091
|
withoutSave: s,
|
|
@@ -2097,7 +2131,7 @@ class Qs {
|
|
|
2097
2131
|
*/
|
|
2098
2132
|
setCanvasBackstoreWidth(t) {
|
|
2099
2133
|
if (!t || typeof t != "number") return;
|
|
2100
|
-
const e =
|
|
2134
|
+
const e = gt(t, Rt, St);
|
|
2101
2135
|
this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
|
|
2102
2136
|
}
|
|
2103
2137
|
/**
|
|
@@ -2106,7 +2140,7 @@ class Qs {
|
|
|
2106
2140
|
*/
|
|
2107
2141
|
setCanvasBackstoreHeight(t) {
|
|
2108
2142
|
if (!t || typeof t != "number") return;
|
|
2109
|
-
const e =
|
|
2143
|
+
const e = gt(t, _t, At);
|
|
2110
2144
|
this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
|
|
2111
2145
|
}
|
|
2112
2146
|
/**
|
|
@@ -2115,7 +2149,7 @@ class Qs {
|
|
|
2115
2149
|
* с учётом минимальных и максимальных значений.
|
|
2116
2150
|
*/
|
|
2117
2151
|
adaptCanvasToContainer() {
|
|
2118
|
-
const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, n = e.clientHeight, o =
|
|
2152
|
+
const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, n = e.clientHeight, o = gt(s, Rt, St), i = gt(n, _t, At);
|
|
2119
2153
|
t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
|
|
2120
2154
|
}
|
|
2121
2155
|
/**
|
|
@@ -2317,18 +2351,18 @@ class Qs {
|
|
|
2317
2351
|
} = this.editor, c = t || n.getActiveObject();
|
|
2318
2352
|
if (!Ks(c)) return;
|
|
2319
2353
|
const { width: d, height: l } = c;
|
|
2320
|
-
let u = Math.min(d,
|
|
2354
|
+
let u = Math.min(d, St), f = Math.min(l, At);
|
|
2321
2355
|
if (e) {
|
|
2322
2356
|
const {
|
|
2323
|
-
width:
|
|
2357
|
+
width: g,
|
|
2324
2358
|
height: p
|
|
2325
|
-
} = o, m = d /
|
|
2326
|
-
u =
|
|
2359
|
+
} = o, m = d / g, v = l / p, M = Math.max(m, v);
|
|
2360
|
+
u = g * M, f = p * M;
|
|
2327
2361
|
}
|
|
2328
|
-
this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(
|
|
2362
|
+
this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(f, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), n.centerObject(c), n.renderAll(), s || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
|
|
2329
2363
|
object: c,
|
|
2330
2364
|
width: u,
|
|
2331
|
-
height:
|
|
2365
|
+
height: f,
|
|
2332
2366
|
preserveAspectRatio: e,
|
|
2333
2367
|
withoutSave: s
|
|
2334
2368
|
});
|
|
@@ -2487,7 +2521,7 @@ class qs {
|
|
|
2487
2521
|
* @private
|
|
2488
2522
|
*/
|
|
2489
2523
|
_fitSingleObject(t, e) {
|
|
2490
|
-
const { canvas: s, montageArea: n } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = o * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180,
|
|
2524
|
+
const { canvas: s, montageArea: n } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = o * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, f = Math.abs(Math.cos(u)), g = Math.abs(Math.sin(u)), p = d * f + l * g, m = d * g + l * f, v = n.width, M = n.height;
|
|
2491
2525
|
let S;
|
|
2492
2526
|
e === "contain" ? S = Math.min(v / p, M / m) : S = Math.max(v / p, M / m), t.set({
|
|
2493
2527
|
scaleX: a * S,
|
|
@@ -2528,11 +2562,11 @@ class qs {
|
|
|
2528
2562
|
}), e)
|
|
2529
2563
|
this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
|
|
2530
2564
|
else {
|
|
2531
|
-
const { width: l, height: u } = o, { width:
|
|
2565
|
+
const { width: l, height: u } = o, { width: f, height: g } = c, p = i.calculateScaleFactor({
|
|
2532
2566
|
imageObject: c,
|
|
2533
2567
|
scaleType: r
|
|
2534
2568
|
});
|
|
2535
|
-
r === "contain" && p < 1 || r === "cover" && (
|
|
2569
|
+
r === "contain" && p < 1 || r === "cover" && (f > l || g > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
|
|
2536
2570
|
}
|
|
2537
2571
|
c.set({ flipX: !1, flipY: !1, angle: 0 }), n.centerObject(c), n.renderAll(), a.resumeHistory(), s || a.saveState(), n.fire("editor:object-reset", {
|
|
2538
2572
|
object: c,
|
|
@@ -2543,7 +2577,16 @@ class qs {
|
|
|
2543
2577
|
}
|
|
2544
2578
|
class Js {
|
|
2545
2579
|
constructor({ editor: t }) {
|
|
2546
|
-
this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Hs, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this.options.defaultScale;
|
|
2580
|
+
this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Hs, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Приводит значение defaultZoom к числу с двумя знаками после запятой, а также учитывает минимальное и максимальное значения.
|
|
2584
|
+
* @param zoom - Значение зума для нормализации
|
|
2585
|
+
* @returns Нормализованное значение зума
|
|
2586
|
+
* @private
|
|
2587
|
+
*/
|
|
2588
|
+
_normalizeDefaultZoom(t) {
|
|
2589
|
+
return Math.min(this.maxZoom, Math.max(this.minZoom, Number(t.toFixed(2))));
|
|
2547
2590
|
}
|
|
2548
2591
|
/**
|
|
2549
2592
|
* Вспомогательный метод для вычисления размеров масштабированной монтажной области
|
|
@@ -2565,7 +2608,7 @@ class Js {
|
|
|
2565
2608
|
* @private
|
|
2566
2609
|
*/
|
|
2567
2610
|
_getClampedPointerCoordinates(t) {
|
|
2568
|
-
const { canvas: e, montageArea: s } = this.editor, n = e.getPointer(t, !0), o = e.viewportTransform, i = e.getZoom(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = a * i + o[4], u = r * i + o[4],
|
|
2611
|
+
const { canvas: e, montageArea: s } = this.editor, n = e.getPointer(t, !0), o = e.viewportTransform, i = e.getZoom(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = a * i + o[4], u = r * i + o[4], f = c * i + o[5], g = d * i + o[5], p = Math.max(l, Math.min(u, n.x)), m = Math.max(f, Math.min(g, n.y));
|
|
2569
2612
|
return {
|
|
2570
2613
|
x: p,
|
|
2571
2614
|
y: m
|
|
@@ -2600,9 +2643,9 @@ class Js {
|
|
|
2600
2643
|
* @private
|
|
2601
2644
|
*/
|
|
2602
2645
|
_calculateEmptySpaceRatio(t) {
|
|
2603
|
-
const { canvas: e, montageArea: s } = this.editor, n = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = -n[4] / t, u = (-n[4] + o) / t,
|
|
2646
|
+
const { canvas: e, montageArea: s } = this.editor, n = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = -n[4] / t, u = (-n[4] + o) / t, f = -n[5] / t, g = (-n[5] + i) / t, p = l < a, m = u > r, v = f < c, M = g > d;
|
|
2604
2647
|
if (!(p || m || v || M)) return 0;
|
|
2605
|
-
const y = Math.max(0, a - l), b = Math.max(0, u - r), I = Math.max(0, c -
|
|
2648
|
+
const y = Math.max(0, a - l), b = Math.max(0, u - r), I = Math.max(0, c - f), j = Math.max(0, g - d), A = Math.max(y, b), C = Math.max(I, j), w = A / o, T = C / i;
|
|
2606
2649
|
return Math.max(w, T);
|
|
2607
2650
|
}
|
|
2608
2651
|
/**
|
|
@@ -2616,11 +2659,11 @@ class Js {
|
|
|
2616
2659
|
* @private
|
|
2617
2660
|
*/
|
|
2618
2661
|
_calculateSmoothCenteringStep(t, e, s, n, o) {
|
|
2619
|
-
const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), l = t.x - r[4], u = t.y - r[5],
|
|
2620
|
-
if (Math.abs(
|
|
2662
|
+
const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), l = t.x - r[4], u = t.y - r[5], f = Math.abs(n), g = e - s;
|
|
2663
|
+
if (Math.abs(g) / f <= 0.1)
|
|
2621
2664
|
return { x: l, y: u };
|
|
2622
|
-
const m = c / 2, v = d / 2, M = a.left, S = a.top, y = m - M * s, b = v - S * s, I = (y - r[4]) / (e - s), j = (b - r[5]) / (e - s), A = I *
|
|
2623
|
-
return { x: E, y:
|
|
2665
|
+
const m = c / 2, v = d / 2, M = a.left, S = a.top, y = m - M * s, b = v - S * s, I = (y - r[4]) / (e - s), j = (b - r[5]) / (e - s), A = I * f, C = j * f, w = A * o, T = C * o, E = Math.abs(w) > Math.abs(l) ? l : w, F = Math.abs(T) > Math.abs(u) ? u : T;
|
|
2666
|
+
return { x: E, y: F };
|
|
2624
2667
|
}
|
|
2625
2668
|
/**
|
|
2626
2669
|
* Применяет плавное центрирование viewport при приближении к defaultZoom.
|
|
@@ -2636,13 +2679,13 @@ class Js {
|
|
|
2636
2679
|
const { canvas: n } = this.editor, o = this._getScaledMontageDimensions(t), i = n.getWidth(), a = n.getHeight(), r = o.width > i || o.height > a, c = this._calculateFitZoom(), d = t - c;
|
|
2637
2680
|
if (!(!r || d) && !e)
|
|
2638
2681
|
return !1;
|
|
2639
|
-
const u = n.viewportTransform,
|
|
2682
|
+
const u = n.viewportTransform, f = this._calculateTargetViewportPosition(t);
|
|
2640
2683
|
if (!r)
|
|
2641
|
-
return u[4] =
|
|
2684
|
+
return u[4] = f.x, u[5] = f.y, n.setViewportTransform(u), !0;
|
|
2642
2685
|
if (e && !r) {
|
|
2643
|
-
const
|
|
2644
|
-
if (
|
|
2645
|
-
const p = this._calculateSmoothCenteringStep(
|
|
2686
|
+
const g = this._calculateEmptySpaceRatio(t);
|
|
2687
|
+
if (g > 0) {
|
|
2688
|
+
const p = this._calculateSmoothCenteringStep(f, t, c, s, g);
|
|
2646
2689
|
return u[4] += p.x, u[5] += p.y, n.setViewportTransform(u), !0;
|
|
2647
2690
|
}
|
|
2648
2691
|
}
|
|
@@ -2657,7 +2700,7 @@ class Js {
|
|
|
2657
2700
|
*/
|
|
2658
2701
|
calculateAndApplyDefaultZoom(t = this.options.defaultScale) {
|
|
2659
2702
|
const { canvas: e } = this.editor, s = e.editorContainer, n = s.clientWidth || e.getWidth(), o = s.clientHeight || e.getHeight(), { width: i, height: a } = this.editor.montageArea, r = n / i * t, c = o / a * t;
|
|
2660
|
-
this.defaultZoom = Math.min(r, c), this.setZoom(), this.editor.panConstraintManager.updateBounds();
|
|
2703
|
+
this.defaultZoom = this._normalizeDefaultZoom(Math.min(r, c)), this.setZoom(), this.editor.panConstraintManager.updateBounds();
|
|
2661
2704
|
}
|
|
2662
2705
|
/**
|
|
2663
2706
|
* Обработчик зума колесом мыши с автоматическим определением точки зума.
|
|
@@ -2708,11 +2751,11 @@ class Js {
|
|
|
2708
2751
|
* @fires editor:zoom-changed
|
|
2709
2752
|
*/
|
|
2710
2753
|
zoom(t = Ye, e = {}) {
|
|
2711
|
-
var
|
|
2754
|
+
var f, g;
|
|
2712
2755
|
if (!t) return;
|
|
2713
|
-
const { minZoom: s, maxZoom: n } = this, { canvas: o } = this.editor, i = t < 0, a = o.getZoom(), r = o.getCenterPoint(), c = (
|
|
2756
|
+
const { minZoom: s, maxZoom: n } = this, { canvas: o } = this.editor, i = t < 0, a = o.getZoom(), r = o.getCenterPoint(), c = (f = e.pointX) != null ? f : r.x, d = (g = e.pointY) != null ? g : r.y, l = new tt(c, d);
|
|
2714
2757
|
this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
|
|
2715
|
-
let u = Number((a + Number(t)).toFixed(
|
|
2758
|
+
let u = Number((a + Number(t)).toFixed(2));
|
|
2716
2759
|
u > n && (u = n), u < s && (u = s), o.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), o.fire("editor:zoom-changed", {
|
|
2717
2760
|
currentZoom: o.getZoom(),
|
|
2718
2761
|
zoom: u,
|
|
@@ -2725,7 +2768,7 @@ class Js {
|
|
|
2725
2768
|
* @fires editor:zoom-changed
|
|
2726
2769
|
*/
|
|
2727
2770
|
setZoom(t = this.defaultZoom) {
|
|
2728
|
-
const { minZoom: e, maxZoom: s } = this, { canvas: n } = this.editor, o = new
|
|
2771
|
+
const { minZoom: e, maxZoom: s } = this, { canvas: n } = this.editor, o = new tt(n.getCenterPoint());
|
|
2729
2772
|
let i = t;
|
|
2730
2773
|
t > s && (i = s), t < e && (i = e), n.zoomToPoint(o, i), n.fire("editor:zoom-changed", {
|
|
2731
2774
|
currentZoom: n.getZoom(),
|
|
@@ -2738,7 +2781,7 @@ class Js {
|
|
|
2738
2781
|
* @fires editor:zoom-changed
|
|
2739
2782
|
*/
|
|
2740
2783
|
resetZoom() {
|
|
2741
|
-
const { canvas: t } = this.editor, e = new
|
|
2784
|
+
const { canvas: t } = this.editor, e = new tt(t.getCenterPoint());
|
|
2742
2785
|
t.zoomToPoint(e, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
|
|
2743
2786
|
currentZoom: t.getZoom(),
|
|
2744
2787
|
point: e
|
|
@@ -3109,11 +3152,11 @@ class Ot {
|
|
|
3109
3152
|
{ offset: 0, color: "#000000" },
|
|
3110
3153
|
{ offset: 1, color: "#ffffff" }
|
|
3111
3154
|
], t.type === "linear") {
|
|
3112
|
-
const u = t.angle * Math.PI / 180,
|
|
3155
|
+
const u = t.angle * Math.PI / 180, f = Ot._angleToCoords(u);
|
|
3113
3156
|
return new ke({
|
|
3114
3157
|
type: "linear",
|
|
3115
3158
|
gradientUnits: "percentage",
|
|
3116
|
-
coords:
|
|
3159
|
+
coords: f,
|
|
3117
3160
|
colorStops: a
|
|
3118
3161
|
});
|
|
3119
3162
|
}
|
|
@@ -3164,7 +3207,7 @@ class Ot {
|
|
|
3164
3207
|
}) ? !1 : t.type === "linear" && e.type === "linear" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 : t.type === "radial" && e.type === "radial" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 && Math.abs(t.coords.r1 - e.coords.r1) < 1e-4 && Math.abs(t.coords.r2 - e.coords.r2) < 1e-4 : !1;
|
|
3165
3208
|
}
|
|
3166
3209
|
}
|
|
3167
|
-
class
|
|
3210
|
+
class te {
|
|
3168
3211
|
constructor({ editor: t }) {
|
|
3169
3212
|
this.editor = t;
|
|
3170
3213
|
}
|
|
@@ -3197,7 +3240,7 @@ class ee {
|
|
|
3197
3240
|
const { canvas: s, historyManager: n } = this.editor;
|
|
3198
3241
|
n.suspendHistory();
|
|
3199
3242
|
const o = t || s.getActiveObject();
|
|
3200
|
-
o && (o instanceof U ?
|
|
3243
|
+
o && (o instanceof U ? te._moveSelectionForward(s, o) : s.bringObjectForward(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-forward", {
|
|
3201
3244
|
object: o,
|
|
3202
3245
|
withoutSave: e
|
|
3203
3246
|
}));
|
|
@@ -3248,7 +3291,7 @@ class ee {
|
|
|
3248
3291
|
} = this.editor;
|
|
3249
3292
|
o.suspendHistory();
|
|
3250
3293
|
const r = t || s.getActiveObject();
|
|
3251
|
-
r && (r instanceof U ?
|
|
3294
|
+
r && (r instanceof U ? te._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(n), i && s.sendObjectToBack(i), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-send-backwards", {
|
|
3252
3295
|
object: r,
|
|
3253
3296
|
withoutSave: e
|
|
3254
3297
|
}));
|
|
@@ -3324,7 +3367,7 @@ class tn {
|
|
|
3324
3367
|
width: n = 100,
|
|
3325
3368
|
height: o = 100,
|
|
3326
3369
|
fill: i = "blue"
|
|
3327
|
-
} = l, a =
|
|
3370
|
+
} = l, a = Mt(l, [
|
|
3328
3371
|
"id",
|
|
3329
3372
|
"left",
|
|
3330
3373
|
"top",
|
|
@@ -3332,7 +3375,7 @@ class tn {
|
|
|
3332
3375
|
"height",
|
|
3333
3376
|
"fill"
|
|
3334
3377
|
]);
|
|
3335
|
-
const { canvas: u } = this.editor,
|
|
3378
|
+
const { canvas: u } = this.editor, f = new us(B({
|
|
3336
3379
|
id: t,
|
|
3337
3380
|
left: e,
|
|
3338
3381
|
top: s,
|
|
@@ -3340,7 +3383,7 @@ class tn {
|
|
|
3340
3383
|
height: o,
|
|
3341
3384
|
fill: i
|
|
3342
3385
|
}, a));
|
|
3343
|
-
return !e && !s && u.centerObject(
|
|
3386
|
+
return !e && !s && u.centerObject(f), c || (u.add(f), r || u.setActiveObject(f), u.renderAll()), f;
|
|
3344
3387
|
}
|
|
3345
3388
|
/**
|
|
3346
3389
|
* Добавление круга
|
|
@@ -3365,14 +3408,14 @@ class tn {
|
|
|
3365
3408
|
top: s,
|
|
3366
3409
|
radius: n = 50,
|
|
3367
3410
|
fill: o = "green"
|
|
3368
|
-
} = d, i =
|
|
3411
|
+
} = d, i = Mt(d, [
|
|
3369
3412
|
"id",
|
|
3370
3413
|
"left",
|
|
3371
3414
|
"top",
|
|
3372
3415
|
"radius",
|
|
3373
3416
|
"fill"
|
|
3374
3417
|
]);
|
|
3375
|
-
const { canvas: l } = this.editor, u = new
|
|
3418
|
+
const { canvas: l } = this.editor, u = new fs(B({
|
|
3376
3419
|
id: t,
|
|
3377
3420
|
left: e,
|
|
3378
3421
|
top: s,
|
|
@@ -3406,7 +3449,7 @@ class tn {
|
|
|
3406
3449
|
width: n = 100,
|
|
3407
3450
|
height: o = 100,
|
|
3408
3451
|
fill: i = "yellow"
|
|
3409
|
-
} = l, a =
|
|
3452
|
+
} = l, a = Mt(l, [
|
|
3410
3453
|
"id",
|
|
3411
3454
|
"left",
|
|
3412
3455
|
"top",
|
|
@@ -3414,7 +3457,7 @@ class tn {
|
|
|
3414
3457
|
"height",
|
|
3415
3458
|
"fill"
|
|
3416
3459
|
]);
|
|
3417
|
-
const { canvas: u } = this.editor,
|
|
3460
|
+
const { canvas: u } = this.editor, f = new gs(B({
|
|
3418
3461
|
id: t,
|
|
3419
3462
|
left: e,
|
|
3420
3463
|
top: s,
|
|
@@ -3422,7 +3465,7 @@ class tn {
|
|
|
3422
3465
|
width: n,
|
|
3423
3466
|
height: o
|
|
3424
3467
|
}, a));
|
|
3425
|
-
return !e && !s && u.centerObject(
|
|
3468
|
+
return !e && !s && u.centerObject(f), c || (u.add(f), r || u.setActiveObject(f), u.renderAll()), f;
|
|
3426
3469
|
}
|
|
3427
3470
|
}
|
|
3428
3471
|
class en {
|
|
@@ -3456,7 +3499,7 @@ class en {
|
|
|
3456
3499
|
return k(this, null, function* () {
|
|
3457
3500
|
const { canvas: e, errorManager: s } = this.editor;
|
|
3458
3501
|
try {
|
|
3459
|
-
const n = yield t.clone(
|
|
3502
|
+
const n = yield t.clone(Kt);
|
|
3460
3503
|
this.clipboard = n, e.fire("editor:object-copied", { object: n });
|
|
3461
3504
|
} catch (n) {
|
|
3462
3505
|
s.emitError({
|
|
@@ -3483,7 +3526,7 @@ class en {
|
|
|
3483
3526
|
message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
|
|
3484
3527
|
}), !1;
|
|
3485
3528
|
try {
|
|
3486
|
-
const s = t.toObject(
|
|
3529
|
+
const s = t.toObject(Kt), n = JSON.stringify(s);
|
|
3487
3530
|
return t.type === "image" ? this._copyImageToClipboard(t, n) : this._copyTextToClipboard(n);
|
|
3488
3531
|
} catch (s) {
|
|
3489
3532
|
return e.emitError({
|
|
@@ -3577,7 +3620,7 @@ class en {
|
|
|
3577
3620
|
const { canvas: e } = this.editor, s = t || e.getActiveObject();
|
|
3578
3621
|
if (!s || s.locked) return !1;
|
|
3579
3622
|
try {
|
|
3580
|
-
const n = yield s.clone(
|
|
3623
|
+
const n = yield s.clone(Kt);
|
|
3581
3624
|
return n instanceof U && n.forEachObject((o) => {
|
|
3582
3625
|
o.set({
|
|
3583
3626
|
id: `${o.type}-${V()}`,
|
|
@@ -3663,7 +3706,7 @@ class en {
|
|
|
3663
3706
|
const { canvas: t } = this.editor;
|
|
3664
3707
|
if (!this.clipboard) return !1;
|
|
3665
3708
|
try {
|
|
3666
|
-
const e = yield this.clipboard.clone(
|
|
3709
|
+
const e = yield this.clipboard.clone(Kt);
|
|
3667
3710
|
return t.discardActiveObject(), e instanceof U && e.forEachObject((s) => {
|
|
3668
3711
|
s.set({
|
|
3669
3712
|
id: `${s.type}-${V()}`,
|
|
@@ -3688,7 +3731,7 @@ class en {
|
|
|
3688
3731
|
});
|
|
3689
3732
|
}
|
|
3690
3733
|
}
|
|
3691
|
-
class
|
|
3734
|
+
class ee {
|
|
3692
3735
|
constructor({ editor: t }) {
|
|
3693
3736
|
this.editor = t;
|
|
3694
3737
|
}
|
|
@@ -3714,9 +3757,9 @@ class se {
|
|
|
3714
3757
|
editable: !1,
|
|
3715
3758
|
locked: !0
|
|
3716
3759
|
};
|
|
3717
|
-
i.set(a), !e &&
|
|
3760
|
+
i.set(a), !e && ee._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
|
|
3718
3761
|
c.set(a);
|
|
3719
|
-
}), n.renderAll(), s || o.saveState(), n.fire("editor:object-locked", {
|
|
3762
|
+
}), i instanceof st && i.isEditing && i.exitEditing(), n.renderAll(), s || o.saveState(), n.fire("editor:object-locked", {
|
|
3720
3763
|
object: i,
|
|
3721
3764
|
skipInnerObjects: e,
|
|
3722
3765
|
withoutSave: s
|
|
@@ -3743,7 +3786,7 @@ class se {
|
|
|
3743
3786
|
editable: !0,
|
|
3744
3787
|
locked: !1
|
|
3745
3788
|
};
|
|
3746
|
-
o.set(i),
|
|
3789
|
+
o.set(i), ee._isGroupOrSelection(o) && o.getObjects().forEach((a) => {
|
|
3747
3790
|
a.set(i);
|
|
3748
3791
|
}), s.renderAll(), e || n.saveState(), s.fire("editor:object-unlocked", {
|
|
3749
3792
|
object: o,
|
|
@@ -3870,7 +3913,7 @@ class nn {
|
|
|
3870
3913
|
o && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
|
|
3871
3914
|
}
|
|
3872
3915
|
}
|
|
3873
|
-
class
|
|
3916
|
+
class we {
|
|
3874
3917
|
constructor({ editor: t }) {
|
|
3875
3918
|
this.editor = t;
|
|
3876
3919
|
}
|
|
@@ -3917,7 +3960,7 @@ class Se {
|
|
|
3917
3960
|
s || o.suspendHistory();
|
|
3918
3961
|
const r = [];
|
|
3919
3962
|
if (a.forEach((d) => {
|
|
3920
|
-
if (
|
|
3963
|
+
if (we._isUngroupableGroup(d)) {
|
|
3921
3964
|
const l = this._handleGroupDeletion(d);
|
|
3922
3965
|
r.push(...l);
|
|
3923
3966
|
return;
|
|
@@ -3932,7 +3975,7 @@ class Se {
|
|
|
3932
3975
|
return n.fire("editor:objects-deleted", c), c;
|
|
3933
3976
|
}
|
|
3934
3977
|
}
|
|
3935
|
-
const
|
|
3978
|
+
const wt = {
|
|
3936
3979
|
IMAGE_MANAGER: {
|
|
3937
3980
|
/**
|
|
3938
3981
|
* Некорректный Content-Type изображения
|
|
@@ -4037,7 +4080,7 @@ const Mt = {
|
|
|
4037
4080
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
4038
4081
|
}
|
|
4039
4082
|
};
|
|
4040
|
-
class
|
|
4083
|
+
class Wt {
|
|
4041
4084
|
constructor({ editor: t }) {
|
|
4042
4085
|
this._buffer = [], this.editor = t;
|
|
4043
4086
|
}
|
|
@@ -4064,7 +4107,7 @@ class Yt {
|
|
|
4064
4107
|
* @fires editor:error
|
|
4065
4108
|
*/
|
|
4066
4109
|
emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: n, message: o }) {
|
|
4067
|
-
if (!
|
|
4110
|
+
if (!Wt.isValidErrorCode(s)) {
|
|
4068
4111
|
console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
|
|
4069
4112
|
return;
|
|
4070
4113
|
}
|
|
@@ -4093,7 +4136,7 @@ class Yt {
|
|
|
4093
4136
|
* @fires editor:warning
|
|
4094
4137
|
*/
|
|
4095
4138
|
emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: n, data: o }) {
|
|
4096
|
-
if (!
|
|
4139
|
+
if (!Wt.isValidErrorCode(s)) {
|
|
4097
4140
|
console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
|
|
4098
4141
|
return;
|
|
4099
4142
|
}
|
|
@@ -4116,7 +4159,7 @@ class Yt {
|
|
|
4116
4159
|
* @returns true, если код допустим, иначе false
|
|
4117
4160
|
*/
|
|
4118
4161
|
static isValidErrorCode(t) {
|
|
4119
|
-
return t ? Object.values(
|
|
4162
|
+
return t ? Object.values(wt).some((e) => Object.values(e).includes(t)) : !1;
|
|
4120
4163
|
}
|
|
4121
4164
|
}
|
|
4122
4165
|
class on {
|
|
@@ -4172,12 +4215,12 @@ class on {
|
|
|
4172
4215
|
const { canvas: s, montageArea: n } = this.editor, o = s.getZoom(), i = n.left, a = n.top, r = s.getWidth() / 2, c = s.getHeight() / 2, d = i * o + t - r, l = a * o + e - c, u = Math.max(
|
|
4173
4216
|
this.currentBounds.minX,
|
|
4174
4217
|
Math.min(this.currentBounds.maxX, d)
|
|
4175
|
-
),
|
|
4218
|
+
), f = Math.max(
|
|
4176
4219
|
this.currentBounds.minY,
|
|
4177
4220
|
Math.min(this.currentBounds.maxY, l)
|
|
4178
|
-
),
|
|
4221
|
+
), g = u + r - i * o, p = f + c - a * o;
|
|
4179
4222
|
return {
|
|
4180
|
-
x:
|
|
4223
|
+
x: g,
|
|
4181
4224
|
y: p
|
|
4182
4225
|
};
|
|
4183
4226
|
}
|
|
@@ -4204,11 +4247,11 @@ class on {
|
|
|
4204
4247
|
this.currentBounds = this.calculatePanBounds();
|
|
4205
4248
|
}
|
|
4206
4249
|
}
|
|
4207
|
-
const
|
|
4250
|
+
const rt = ({
|
|
4208
4251
|
value: h,
|
|
4209
4252
|
min: t,
|
|
4210
4253
|
max: e
|
|
4211
|
-
}) => Math.min(Math.max(h, t), e), Dt = class Dt extends
|
|
4254
|
+
}) => Math.min(Math.max(h, t), e), Dt = class Dt extends st {
|
|
4212
4255
|
constructor(t, e = {}) {
|
|
4213
4256
|
var s, n, o, i, a, r, c, d, l;
|
|
4214
4257
|
super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (n = e.paddingTop) != null ? n : 0, this.paddingRight = (o = e.paddingRight) != null ? o : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0, this._roundDimensions();
|
|
@@ -4229,11 +4272,11 @@ const at = ({
|
|
|
4229
4272
|
}
|
|
4230
4273
|
_getNonTransformedDimensions() {
|
|
4231
4274
|
const { width: t, height: e } = this._getBackgroundDimensions();
|
|
4232
|
-
return new
|
|
4275
|
+
return new tt(t, e).scalarAdd(this.strokeWidth);
|
|
4233
4276
|
}
|
|
4234
4277
|
_getTransformedDimensions(t = {}) {
|
|
4235
4278
|
const { width: e, height: s } = this._getBackgroundDimensions();
|
|
4236
|
-
return super._getTransformedDimensions(
|
|
4279
|
+
return super._getTransformedDimensions(bt(B({}, t), {
|
|
4237
4280
|
width: e,
|
|
4238
4281
|
height: s
|
|
4239
4282
|
}));
|
|
@@ -4243,7 +4286,7 @@ const at = ({
|
|
|
4243
4286
|
*/
|
|
4244
4287
|
toObject(t = []) {
|
|
4245
4288
|
const e = super.toObject(t);
|
|
4246
|
-
return
|
|
4289
|
+
return bt(B({}, e), {
|
|
4247
4290
|
backgroundOpacity: this.backgroundOpacity,
|
|
4248
4291
|
paddingTop: this.paddingTop,
|
|
4249
4292
|
paddingRight: this.paddingRight,
|
|
@@ -4282,10 +4325,10 @@ const at = ({
|
|
|
4282
4325
|
var i, a, r, c;
|
|
4283
4326
|
const s = t / 2, n = e / 2, o = Math.min(s, n);
|
|
4284
4327
|
return {
|
|
4285
|
-
bottomLeft:
|
|
4286
|
-
bottomRight:
|
|
4287
|
-
topLeft:
|
|
4288
|
-
topRight:
|
|
4328
|
+
bottomLeft: rt({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
|
|
4329
|
+
bottomRight: rt({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
|
|
4330
|
+
topLeft: rt({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
|
|
4331
|
+
topRight: rt({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
|
|
4289
4332
|
};
|
|
4290
4333
|
}
|
|
4291
4334
|
_getPadding() {
|
|
@@ -4301,12 +4344,12 @@ const at = ({
|
|
|
4301
4344
|
var n;
|
|
4302
4345
|
const t = this.backgroundColor;
|
|
4303
4346
|
if (!t) return null;
|
|
4304
|
-
const e =
|
|
4347
|
+
const e = rt({ value: (n = this.backgroundOpacity) != null ? n : 1, min: 0, max: 1 });
|
|
4305
4348
|
let s;
|
|
4306
4349
|
try {
|
|
4307
4350
|
s = new ps(t);
|
|
4308
4351
|
} catch (o) {
|
|
4309
|
-
return
|
|
4352
|
+
return Wt.emitError({
|
|
4310
4353
|
origin: "BackgroundTextbox",
|
|
4311
4354
|
method: "_getEffectiveBackgroundFill",
|
|
4312
4355
|
code: "INVALID_COLOR_VALUE",
|
|
@@ -4329,8 +4372,8 @@ const at = ({
|
|
|
4329
4372
|
topRight: d,
|
|
4330
4373
|
bottomRight: l,
|
|
4331
4374
|
bottomLeft: u
|
|
4332
|
-
} = n,
|
|
4333
|
-
t.beginPath(), t.moveTo(s +
|
|
4375
|
+
} = n, f = rt({ value: c, min: 0, max: i }), g = rt({ value: d, min: 0, max: i }), p = rt({ value: l, min: 0, max: i }), m = rt({ value: u, min: 0, max: i });
|
|
4376
|
+
t.beginPath(), t.moveTo(s + f, o), t.lineTo(a - g, o), t.quadraticCurveTo(a, o, a, o + g), t.lineTo(a, r - p), t.quadraticCurveTo(a, r, a - p, r), t.lineTo(s + m, r), t.quadraticCurveTo(s, r, s, r - m), t.lineTo(s, o + f), t.quadraticCurveTo(s, o, s + f, o), t.closePath();
|
|
4334
4377
|
}
|
|
4335
4378
|
/**
|
|
4336
4379
|
* Округляет текущие значения ширины и высоты до ближайших целых.
|
|
@@ -4344,7 +4387,7 @@ const at = ({
|
|
|
4344
4387
|
}
|
|
4345
4388
|
};
|
|
4346
4389
|
Dt.type = "background-textbox", Dt.cacheProperties = [
|
|
4347
|
-
...Array.isArray(
|
|
4390
|
+
...Array.isArray(st.cacheProperties) ? st.cacheProperties : [],
|
|
4348
4391
|
"backgroundColor",
|
|
4349
4392
|
"backgroundOpacity",
|
|
4350
4393
|
"paddingTop",
|
|
@@ -4356,7 +4399,7 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
|
|
|
4356
4399
|
"radiusBottomRight",
|
|
4357
4400
|
"radiusBottomLeft"
|
|
4358
4401
|
], Dt.stateProperties = [
|
|
4359
|
-
...Array.isArray(
|
|
4402
|
+
...Array.isArray(st.stateProperties) ? st.stateProperties : [],
|
|
4360
4403
|
"backgroundColor",
|
|
4361
4404
|
"backgroundOpacity",
|
|
4362
4405
|
"paddingTop",
|
|
@@ -4368,10 +4411,10 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
|
|
|
4368
4411
|
"radiusBottomRight",
|
|
4369
4412
|
"radiusBottomLeft"
|
|
4370
4413
|
];
|
|
4371
|
-
let
|
|
4414
|
+
let se = Dt;
|
|
4372
4415
|
const an = () => {
|
|
4373
4416
|
var h;
|
|
4374
|
-
(h = ze) != null && h.setClass && ze.setClass(
|
|
4417
|
+
(h = ze) != null && h.setClass && ze.setClass(se, "background-textbox");
|
|
4375
4418
|
}, rn = ({ textbox: h }) => {
|
|
4376
4419
|
var s, n;
|
|
4377
4420
|
if (!h.isEditing) return null;
|
|
@@ -4389,7 +4432,7 @@ const an = () => {
|
|
|
4389
4432
|
if (!t) return !1;
|
|
4390
4433
|
const e = (n = (s = h.text) == null ? void 0 : s.length) != null ? n : 0;
|
|
4391
4434
|
return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
|
|
4392
|
-
},
|
|
4435
|
+
}, ae = ({
|
|
4393
4436
|
textbox: h,
|
|
4394
4437
|
styles: t,
|
|
4395
4438
|
range: e
|
|
@@ -4411,8 +4454,8 @@ const an = () => {
|
|
|
4411
4454
|
);
|
|
4412
4455
|
if (s.length)
|
|
4413
4456
|
return (n = s[0]) == null ? void 0 : n[e];
|
|
4414
|
-
}, Ve = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Xe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0,
|
|
4415
|
-
class
|
|
4457
|
+
}, Ve = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Xe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, re = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", ot = 0.01;
|
|
4458
|
+
class P {
|
|
4416
4459
|
constructor({ editor: t }) {
|
|
4417
4460
|
var e;
|
|
4418
4461
|
this._handleTextEditingEntered = () => {
|
|
@@ -4420,23 +4463,23 @@ class W {
|
|
|
4420
4463
|
}, this._handleTextEditingExited = (s) => {
|
|
4421
4464
|
var r, c;
|
|
4422
4465
|
const { target: n } = s;
|
|
4423
|
-
if (!
|
|
4466
|
+
if (!P._isTextbox(n)) return;
|
|
4424
4467
|
const o = (r = n.text) != null ? r : "";
|
|
4425
4468
|
if (!!n.uppercase) {
|
|
4426
4469
|
const d = (c = n.textCaseRaw) != null ? c : o.toLocaleLowerCase();
|
|
4427
4470
|
n.textCaseRaw = d;
|
|
4428
4471
|
} else
|
|
4429
4472
|
n.textCaseRaw = o;
|
|
4430
|
-
|
|
4473
|
+
P._roundTextboxDimensions({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
4431
4474
|
lockMovementX: !1,
|
|
4432
4475
|
lockMovementY: !1
|
|
4433
4476
|
}), setTimeout(() => {
|
|
4434
4477
|
this.isTextEditingActive = !1, this.editor.historyManager.saveState();
|
|
4435
4478
|
}, Vs);
|
|
4436
4479
|
}, this._handleObjectScaling = (s) => {
|
|
4437
|
-
var kt,
|
|
4480
|
+
var kt, K, Ct, Ht, vt, Zt, Tt, Ae, je, Ie, Ce, Te, Ee;
|
|
4438
4481
|
const { target: n, transform: o } = s;
|
|
4439
|
-
if (n instanceof U || !
|
|
4482
|
+
if (n instanceof U || !P._isTextbox(n) || !o) return;
|
|
4440
4483
|
n.isScaling = !0;
|
|
4441
4484
|
const i = this._ensureScalingState(n), {
|
|
4442
4485
|
baseWidth: a,
|
|
@@ -4445,21 +4488,21 @@ class W {
|
|
|
4445
4488
|
basePadding: d,
|
|
4446
4489
|
baseRadii: l,
|
|
4447
4490
|
baseStyles: u
|
|
4448
|
-
} = i,
|
|
4491
|
+
} = i, f = typeof ((kt = o.original) == null ? void 0 : kt.width) == "number" ? o.original.width : void 0, g = typeof ((K = o.original) == null ? void 0 : K.left) == "number" ? o.original.left : void 0, p = f != null ? f : a, m = g != null ? g : r, v = (Ct = o.corner) != null ? Ct : "", M = (Ht = o.action) != null ? Ht : "", S = ["ml", "mr"].includes(v) || M === "scaleX", y = ["mt", "mb"].includes(v) || M === "scaleY", b = ["tl", "tr", "bl", "br"].includes(v) || M === "scale", I = b || y;
|
|
4449
4492
|
if (!S && !y && !b) return;
|
|
4450
|
-
const j = Math.abs((
|
|
4493
|
+
const j = Math.abs((Zt = (vt = n.scaleX) != null ? vt : o.scaleX) != null ? Zt : 1) || 1, A = Math.abs((Ae = (Tt = n.scaleY) != null ? Tt : o.scaleY) != null ? Ae : 1) || 1, C = Math.max(1, p * j), w = Math.max(1, Math.round(C)), T = Math.max(1, c * A), {
|
|
4451
4494
|
paddingTop: E = 0,
|
|
4452
|
-
paddingRight:
|
|
4495
|
+
paddingRight: F = 0,
|
|
4453
4496
|
paddingBottom: x = 0,
|
|
4454
4497
|
paddingLeft: N = 0,
|
|
4455
4498
|
radiusTopLeft: Z = 0,
|
|
4456
4499
|
radiusTopRight: D = 0,
|
|
4457
4500
|
radiusBottomRight: _ = 0,
|
|
4458
|
-
radiusBottomLeft:
|
|
4501
|
+
radiusBottomLeft: W = 0,
|
|
4459
4502
|
fontSize: G,
|
|
4460
4503
|
width: Y,
|
|
4461
|
-
originX:
|
|
4462
|
-
} = n,
|
|
4504
|
+
originX: X = "left"
|
|
4505
|
+
} = n, et = b || y, J = b || y, H = et ? {
|
|
4463
4506
|
top: Math.max(0, d.top * A),
|
|
4464
4507
|
right: Math.max(0, d.right * A),
|
|
4465
4508
|
bottom: Math.max(0, d.bottom * A),
|
|
@@ -4469,26 +4512,26 @@ class W {
|
|
|
4469
4512
|
topRight: Math.max(0, l.topRight * A),
|
|
4470
4513
|
bottomRight: Math.max(0, l.bottomRight * A),
|
|
4471
4514
|
bottomLeft: Math.max(0, l.bottomLeft * A)
|
|
4472
|
-
} : l,
|
|
4473
|
-
let
|
|
4474
|
-
if (I &&
|
|
4475
|
-
const
|
|
4515
|
+
} : l, jt = Object.keys(u).length > 0;
|
|
4516
|
+
let nt;
|
|
4517
|
+
if (I && jt) {
|
|
4518
|
+
const oe = {};
|
|
4476
4519
|
Object.entries(u).forEach(([as, Oe]) => {
|
|
4477
4520
|
if (!Oe) return;
|
|
4478
|
-
const
|
|
4479
|
-
Object.entries(Oe).forEach(([rs,
|
|
4480
|
-
if (!
|
|
4481
|
-
const Le = B({},
|
|
4482
|
-
typeof
|
|
4483
|
-
}), Object.keys(
|
|
4484
|
-
}), Object.keys(
|
|
4521
|
+
const ie = {};
|
|
4522
|
+
Object.entries(Oe).forEach(([rs, Gt]) => {
|
|
4523
|
+
if (!Gt) return;
|
|
4524
|
+
const Le = B({}, Gt);
|
|
4525
|
+
typeof Gt.fontSize == "number" && (Le.fontSize = Math.max(1, Gt.fontSize * A)), ie[rs] = Le;
|
|
4526
|
+
}), Object.keys(ie).length && (oe[as] = ie);
|
|
4527
|
+
}), Object.keys(oe).length && (nt = oe);
|
|
4485
4528
|
}
|
|
4486
|
-
const
|
|
4487
|
-
if (!
|
|
4529
|
+
const ht = (Ie = (je = o.originX) != null ? je : X) != null ? Ie : "left", mt = m + p, It = m + p / 2, it = Y != null ? Y : p, yt = w !== it, ne = Math.abs(T - (G != null ? G : c)) > ot, Yt = Math.abs(H.top - E) > ot || Math.abs(H.right - F) > ot || Math.abs(H.bottom - x) > ot || Math.abs(H.left - N) > ot, xt = Math.abs(q.topLeft - Z) > ot || Math.abs(q.topRight - D) > ot || Math.abs(q.bottomRight - _) > ot || Math.abs(q.bottomLeft - W) > ot;
|
|
4530
|
+
if (!yt && !ne && !Yt && !xt) {
|
|
4488
4531
|
n.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
|
|
4489
4532
|
return;
|
|
4490
4533
|
}
|
|
4491
|
-
|
|
4534
|
+
nt && (n.styles = nt), n.set({
|
|
4492
4535
|
width: w,
|
|
4493
4536
|
fontSize: I ? T : c,
|
|
4494
4537
|
paddingTop: H.top,
|
|
@@ -4502,13 +4545,13 @@ class W {
|
|
|
4502
4545
|
scaleX: 1,
|
|
4503
4546
|
scaleY: 1
|
|
4504
4547
|
});
|
|
4505
|
-
const Nt =
|
|
4548
|
+
const Nt = P._roundTextboxDimensions({ textbox: n });
|
|
4506
4549
|
Nt && (n.dirty = !0);
|
|
4507
|
-
const
|
|
4550
|
+
const ut = (Ce = n.width) != null ? Ce : w, Bt = ut !== it;
|
|
4508
4551
|
let ft = m;
|
|
4509
|
-
Bt && (S || b) && (
|
|
4510
|
-
const { original:
|
|
4511
|
-
|
|
4552
|
+
Bt && (S || b) && (ht === "right" ? ft = mt - ut : ht === "center" && (ft = It - ut / 2)), n.set({ left: ft }), i.baseLeft = ft, o.scaleX = 1, o.scaleY = 1;
|
|
4553
|
+
const { original: at } = o;
|
|
4554
|
+
at && (at.scaleX = 1, at.scaleY = 1, at.width = ut, at.height = n.height, at.left = ft), n.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ut, i.baseFontSize = (Te = n.fontSize) != null ? Te : T, i.baseStyles = JSON.parse(JSON.stringify((Ee = n.styles) != null ? Ee : {})), i.basePadding = {
|
|
4512
4555
|
top: H.top,
|
|
4513
4556
|
right: H.right,
|
|
4514
4557
|
bottom: H.bottom,
|
|
@@ -4518,52 +4561,52 @@ class W {
|
|
|
4518
4561
|
topRight: q.topRight,
|
|
4519
4562
|
bottomRight: q.bottomRight,
|
|
4520
4563
|
bottomLeft: q.bottomLeft
|
|
4521
|
-
}, i.hasWidthChange = Bt ||
|
|
4564
|
+
}, i.hasWidthChange = Bt || ne || Yt || xt || Nt;
|
|
4522
4565
|
}, this._handleObjectModified = (s) => {
|
|
4523
4566
|
var M, S, y;
|
|
4524
4567
|
const { target: n } = s;
|
|
4525
4568
|
if (n instanceof U) {
|
|
4526
4569
|
const b = n.getObjects();
|
|
4527
|
-
if (!b.some((w) =>
|
|
4570
|
+
if (!b.some((w) => P._isTextbox(w))) return;
|
|
4528
4571
|
const { scaleX: j = 1, scaleY: A = 1 } = n;
|
|
4529
|
-
if (Math.abs(j - 1) <
|
|
4572
|
+
if (Math.abs(j - 1) < ot && Math.abs(A - 1) < ot) return;
|
|
4530
4573
|
this.canvas.discardActiveObject(), b.forEach((w) => {
|
|
4531
|
-
var T, E,
|
|
4532
|
-
if (
|
|
4533
|
-
const N = (T = w.scaleX) != null ? T : 1, Z = (E = w.scaleY) != null ? E : 1, D = ((
|
|
4574
|
+
var T, E, F, x;
|
|
4575
|
+
if (P._isTextbox(w)) {
|
|
4576
|
+
const N = (T = w.scaleX) != null ? T : 1, Z = (E = w.scaleY) != null ? E : 1, D = ((F = w.fontSize) != null ? F : 16) * Z, _ = ((x = w.width) != null ? x : 0) * N, W = Z, {
|
|
4534
4577
|
paddingTop: G = 0,
|
|
4535
4578
|
paddingRight: Y = 0,
|
|
4536
|
-
paddingBottom:
|
|
4537
|
-
paddingLeft:
|
|
4579
|
+
paddingBottom: X = 0,
|
|
4580
|
+
paddingLeft: et = 0,
|
|
4538
4581
|
radiusTopLeft: J = 0,
|
|
4539
4582
|
radiusTopRight: H = 0,
|
|
4540
4583
|
radiusBottomRight: q = 0,
|
|
4541
|
-
radiusBottomLeft:
|
|
4542
|
-
styles:
|
|
4543
|
-
} = w,
|
|
4544
|
-
paddingTop: Math.max(0, G *
|
|
4545
|
-
paddingRight: Math.max(0, Y *
|
|
4546
|
-
paddingBottom: Math.max(0,
|
|
4547
|
-
paddingLeft: Math.max(0,
|
|
4584
|
+
radiusBottomLeft: jt = 0,
|
|
4585
|
+
styles: nt
|
|
4586
|
+
} = w, ht = {
|
|
4587
|
+
paddingTop: Math.max(0, G * W),
|
|
4588
|
+
paddingRight: Math.max(0, Y * W),
|
|
4589
|
+
paddingBottom: Math.max(0, X * W),
|
|
4590
|
+
paddingLeft: Math.max(0, et * W)
|
|
4548
4591
|
}, mt = {
|
|
4549
|
-
radiusTopLeft: Math.max(0, J *
|
|
4550
|
-
radiusTopRight: Math.max(0, H *
|
|
4551
|
-
radiusBottomRight: Math.max(0, q *
|
|
4552
|
-
radiusBottomLeft: Math.max(0,
|
|
4592
|
+
radiusTopLeft: Math.max(0, J * W),
|
|
4593
|
+
radiusTopRight: Math.max(0, H * W),
|
|
4594
|
+
radiusBottomRight: Math.max(0, q * W),
|
|
4595
|
+
radiusBottomLeft: Math.max(0, jt * W)
|
|
4553
4596
|
};
|
|
4554
|
-
let
|
|
4555
|
-
|
|
4556
|
-
Object.values(
|
|
4557
|
-
typeof
|
|
4597
|
+
let It = nt;
|
|
4598
|
+
nt && Object.keys(nt).length > 0 && (It = JSON.parse(JSON.stringify(nt)), Object.values(It).forEach((it) => {
|
|
4599
|
+
Object.values(it).forEach((yt) => {
|
|
4600
|
+
typeof yt.fontSize == "number" && (yt.fontSize = Math.max(1, yt.fontSize * W));
|
|
4558
4601
|
});
|
|
4559
|
-
})), w.set(
|
|
4602
|
+
})), w.set(bt(B(B({
|
|
4560
4603
|
fontSize: D,
|
|
4561
4604
|
width: _,
|
|
4562
4605
|
scaleX: 1,
|
|
4563
4606
|
scaleY: 1
|
|
4564
|
-
},
|
|
4565
|
-
styles:
|
|
4566
|
-
})),
|
|
4607
|
+
}, ht), mt), {
|
|
4608
|
+
styles: It
|
|
4609
|
+
})), P._roundTextboxDimensions({ textbox: w });
|
|
4567
4610
|
}
|
|
4568
4611
|
w.setCoords();
|
|
4569
4612
|
});
|
|
@@ -4573,7 +4616,7 @@ class W {
|
|
|
4573
4616
|
this.canvas.setActiveObject(C), this.canvas.requestRenderAll();
|
|
4574
4617
|
return;
|
|
4575
4618
|
}
|
|
4576
|
-
if (!
|
|
4619
|
+
if (!P._isTextbox(n)) return;
|
|
4577
4620
|
n.isScaling = !1;
|
|
4578
4621
|
const o = this.scalingState.get(n);
|
|
4579
4622
|
if (this.scalingState.delete(n), !(o != null && o.hasWidthChange)) return;
|
|
@@ -4582,8 +4625,8 @@ class W {
|
|
|
4582
4625
|
paddingRight: d = 0,
|
|
4583
4626
|
paddingBottom: l = 0,
|
|
4584
4627
|
paddingLeft: u = 0,
|
|
4585
|
-
radiusTopLeft:
|
|
4586
|
-
radiusTopRight:
|
|
4628
|
+
radiusTopLeft: f = 0,
|
|
4629
|
+
radiusTopRight: g = 0,
|
|
4587
4630
|
radiusBottomRight: p = 0,
|
|
4588
4631
|
radiusBottomLeft: m = 0
|
|
4589
4632
|
} = n, v = {
|
|
@@ -4592,8 +4635,8 @@ class W {
|
|
|
4592
4635
|
paddingRight: d,
|
|
4593
4636
|
paddingBottom: l,
|
|
4594
4637
|
paddingLeft: u,
|
|
4595
|
-
radiusTopLeft:
|
|
4596
|
-
radiusTopRight:
|
|
4638
|
+
radiusTopLeft: f,
|
|
4639
|
+
radiusTopRight: g,
|
|
4597
4640
|
radiusBottomRight: p,
|
|
4598
4641
|
radiusBottomLeft: m
|
|
4599
4642
|
};
|
|
@@ -4608,8 +4651,8 @@ class W {
|
|
|
4608
4651
|
* @param options — настройки текста
|
|
4609
4652
|
* @param flags — флаги поведения
|
|
4610
4653
|
*/
|
|
4611
|
-
addText(
|
|
4612
|
-
var x =
|
|
4654
|
+
addText(F = {}, { withoutSelection: w = !1, withoutSave: T = !1, withoutAdding: E = !1 } = {}) {
|
|
4655
|
+
var x = F, {
|
|
4613
4656
|
id: t = `text-${V()}`,
|
|
4614
4657
|
text: e = "Новый текст",
|
|
4615
4658
|
fontFamily: s,
|
|
@@ -4622,8 +4665,8 @@ class W {
|
|
|
4622
4665
|
align: d = "left",
|
|
4623
4666
|
color: l = "#000000",
|
|
4624
4667
|
strokeColor: u,
|
|
4625
|
-
strokeWidth:
|
|
4626
|
-
opacity:
|
|
4668
|
+
strokeWidth: f = 0,
|
|
4669
|
+
opacity: g = 1,
|
|
4627
4670
|
backgroundColor: p,
|
|
4628
4671
|
backgroundOpacity: m = 1,
|
|
4629
4672
|
paddingTop: v = 0,
|
|
@@ -4634,7 +4677,7 @@ class W {
|
|
|
4634
4677
|
radiusTopRight: I = 0,
|
|
4635
4678
|
radiusBottomRight: j = 0,
|
|
4636
4679
|
radiusBottomLeft: A = 0
|
|
4637
|
-
} = x, C =
|
|
4680
|
+
} = x, C = Mt(x, [
|
|
4638
4681
|
"id",
|
|
4639
4682
|
"text",
|
|
4640
4683
|
"fontFamily",
|
|
@@ -4660,10 +4703,10 @@ class W {
|
|
|
4660
4703
|
"radiusBottomRight",
|
|
4661
4704
|
"radiusBottomLeft"
|
|
4662
4705
|
]);
|
|
4663
|
-
var
|
|
4706
|
+
var et;
|
|
4664
4707
|
const { historyManager: N } = this.editor, { canvas: Z } = this;
|
|
4665
4708
|
N.suspendHistory();
|
|
4666
|
-
const D = s != null ? s : this._getDefaultFontFamily(), _ = Xe({ width:
|
|
4709
|
+
const D = s != null ? s : this._getDefaultFontFamily(), _ = Xe({ width: f }), W = Ve({
|
|
4667
4710
|
strokeColor: u,
|
|
4668
4711
|
width: _
|
|
4669
4712
|
}), G = B({
|
|
@@ -4677,10 +4720,10 @@ class W {
|
|
|
4677
4720
|
linethrough: c,
|
|
4678
4721
|
textAlign: d,
|
|
4679
4722
|
fill: l,
|
|
4680
|
-
stroke:
|
|
4723
|
+
stroke: W,
|
|
4681
4724
|
strokeWidth: _,
|
|
4682
4725
|
strokeUniform: !0,
|
|
4683
|
-
opacity:
|
|
4726
|
+
opacity: g,
|
|
4684
4727
|
backgroundColor: p,
|
|
4685
4728
|
backgroundOpacity: m,
|
|
4686
4729
|
paddingTop: v,
|
|
@@ -4691,21 +4734,21 @@ class W {
|
|
|
4691
4734
|
radiusTopRight: I,
|
|
4692
4735
|
radiusBottomRight: j,
|
|
4693
4736
|
radiusBottomLeft: A
|
|
4694
|
-
}, C), Y = new
|
|
4695
|
-
if (Y.textCaseRaw = (
|
|
4696
|
-
const J =
|
|
4737
|
+
}, C), Y = new se(e, G);
|
|
4738
|
+
if (Y.textCaseRaw = (et = Y.text) != null ? et : "", r) {
|
|
4739
|
+
const J = re({ value: Y.textCaseRaw });
|
|
4697
4740
|
J !== Y.text && Y.set({ text: J });
|
|
4698
4741
|
}
|
|
4699
|
-
return
|
|
4742
|
+
return P._roundTextboxDimensions({ textbox: Y }) && (Y.dirty = !0), C.left === void 0 && C.top === void 0 && Z.centerObject(Y), E || Z.add(Y), w || Z.setActiveObject(Y), Z.requestRenderAll(), N.resumeHistory(), T || N.saveState(), Z.fire("editor:text-added", {
|
|
4700
4743
|
textbox: Y,
|
|
4701
|
-
options:
|
|
4744
|
+
options: bt(B({}, G), {
|
|
4702
4745
|
text: e,
|
|
4703
4746
|
bold: o,
|
|
4704
4747
|
italic: i,
|
|
4705
4748
|
strikethrough: c,
|
|
4706
4749
|
align: d,
|
|
4707
4750
|
color: l,
|
|
4708
|
-
strokeColor:
|
|
4751
|
+
strokeColor: W,
|
|
4709
4752
|
strokeWidth: _
|
|
4710
4753
|
}),
|
|
4711
4754
|
flags: {
|
|
@@ -4724,18 +4767,18 @@ class W {
|
|
|
4724
4767
|
* @param options.skipRender — не вызывать перерисовку канваса
|
|
4725
4768
|
*/
|
|
4726
4769
|
updateText({ target: t, style: e = {}, withoutSave: s, skipRender: n } = {}) {
|
|
4727
|
-
var Nt,
|
|
4770
|
+
var Nt, ut, Bt, ft, at, kt;
|
|
4728
4771
|
const o = this._resolveTextObject(t);
|
|
4729
4772
|
if (!o) return null;
|
|
4730
4773
|
const { historyManager: i } = this.editor, { canvas: a } = this;
|
|
4731
4774
|
i.suspendHistory();
|
|
4732
|
-
const r =
|
|
4775
|
+
const r = P._getSnapshot(o), xt = e, {
|
|
4733
4776
|
text: c,
|
|
4734
4777
|
fontFamily: d,
|
|
4735
4778
|
fontSize: l,
|
|
4736
4779
|
bold: u,
|
|
4737
|
-
italic:
|
|
4738
|
-
underline:
|
|
4780
|
+
italic: f,
|
|
4781
|
+
underline: g,
|
|
4739
4782
|
uppercase: p,
|
|
4740
4783
|
strikethrough: m,
|
|
4741
4784
|
align: v,
|
|
@@ -4750,10 +4793,10 @@ class W {
|
|
|
4750
4793
|
paddingBottom: w,
|
|
4751
4794
|
paddingLeft: T,
|
|
4752
4795
|
radiusTopLeft: E,
|
|
4753
|
-
radiusTopRight:
|
|
4796
|
+
radiusTopRight: F,
|
|
4754
4797
|
radiusBottomRight: x,
|
|
4755
4798
|
radiusBottomLeft: N
|
|
4756
|
-
} = xt, Z =
|
|
4799
|
+
} = xt, Z = Mt(xt, [
|
|
4757
4800
|
"text",
|
|
4758
4801
|
"fontFamily",
|
|
4759
4802
|
"fontSize",
|
|
@@ -4777,41 +4820,46 @@ class W {
|
|
|
4777
4820
|
"radiusTopRight",
|
|
4778
4821
|
"radiusBottomRight",
|
|
4779
4822
|
"radiusBottomLeft"
|
|
4780
|
-
]), D = B({}, Z), _ = rn({ textbox: o }),
|
|
4781
|
-
if (d !== void 0 && (
|
|
4782
|
-
const
|
|
4783
|
-
_ && (G.fontWeight =
|
|
4784
|
-
}
|
|
4785
|
-
if (
|
|
4786
|
-
const
|
|
4787
|
-
_ && (G.fontStyle =
|
|
4788
|
-
}
|
|
4789
|
-
if (
|
|
4790
|
-
const
|
|
4791
|
-
strokeColor:
|
|
4792
|
-
width:
|
|
4823
|
+
]), D = B({}, Z), _ = rn({ textbox: o }), W = _ ? P._expandRangeToFullLines({ textbox: o, range: _ }) : null, G = {}, Y = {}, X = {}, et = dn({ textbox: o, range: _ }), J = !_ || et, H = !_;
|
|
4824
|
+
if (d !== void 0 && (W && (Y.fontFamily = d), J && (D.fontFamily = d, H && (X.fontFamily = d))), l !== void 0 && (W && (Y.fontSize = l), J && (D.fontSize = l, H && (X.fontSize = l))), u !== void 0) {
|
|
4825
|
+
const K = u ? "bold" : "normal";
|
|
4826
|
+
_ && (G.fontWeight = K), J && (D.fontWeight = K, H && (X.fontWeight = K));
|
|
4827
|
+
}
|
|
4828
|
+
if (f !== void 0) {
|
|
4829
|
+
const K = f ? "italic" : "normal";
|
|
4830
|
+
_ && (G.fontStyle = K), J && (D.fontStyle = K, H && (X.fontStyle = K));
|
|
4831
|
+
}
|
|
4832
|
+
if (g !== void 0 && (_ && (G.underline = g), J && (D.underline = g, H && (X.underline = g))), m !== void 0 && (_ && (G.linethrough = m), J && (D.linethrough = m, H && (X.linethrough = m))), v !== void 0 && (D.textAlign = v), M !== void 0 && (_ && (G.fill = M), J && (D.fill = M, H && (X.fill = M))), S !== void 0 || y !== void 0) {
|
|
4833
|
+
const K = _ ? Ge({ textbox: o, range: _, property: "strokeWidth" }) : void 0, Ct = _ ? Ge({ textbox: o, range: _, property: "stroke" }) : void 0, Ht = (ut = (Nt = y != null ? y : K) != null ? Nt : o.strokeWidth) != null ? ut : 0, vt = Xe({ width: Ht }), Zt = (ft = (Bt = S != null ? S : Ct) != null ? Bt : o.stroke) != null ? ft : void 0, Tt = Ve({
|
|
4834
|
+
strokeColor: Zt,
|
|
4835
|
+
width: vt
|
|
4793
4836
|
});
|
|
4794
|
-
_ && (G.stroke =
|
|
4837
|
+
_ && (G.stroke = Tt, G.strokeWidth = vt), J && (D.stroke = Tt, D.strokeWidth = vt, H && (X.stroke = Tt, X.strokeWidth = vt));
|
|
4795
4838
|
}
|
|
4796
|
-
b !== void 0 && (D.opacity = b), I !== void 0 && (D.backgroundColor = I), j !== void 0 && (D.backgroundOpacity = j), A !== void 0 && (D.paddingTop = A), C !== void 0 && (D.paddingRight = C), w !== void 0 && (D.paddingBottom = w), T !== void 0 && (D.paddingLeft = T), E !== void 0 && (D.radiusTopLeft = E),
|
|
4797
|
-
const q = (kt = o.textCaseRaw) != null ? kt : (
|
|
4798
|
-
if (
|
|
4799
|
-
const
|
|
4800
|
-
D.text =
|
|
4839
|
+
b !== void 0 && (D.opacity = b), I !== void 0 && (D.backgroundColor = I), j !== void 0 && (D.backgroundOpacity = j), A !== void 0 && (D.paddingTop = A), C !== void 0 && (D.paddingRight = C), w !== void 0 && (D.paddingBottom = w), T !== void 0 && (D.paddingLeft = T), E !== void 0 && (D.radiusTopLeft = E), F !== void 0 && (D.radiusTopRight = F), x !== void 0 && (D.radiusBottomRight = x), N !== void 0 && (D.radiusBottomLeft = N);
|
|
4840
|
+
const q = (kt = o.textCaseRaw) != null ? kt : (at = o.text) != null ? at : "", jt = !!o.uppercase, nt = c !== void 0, ht = nt ? c != null ? c : "" : q, mt = p != null ? p : jt;
|
|
4841
|
+
if (nt || mt !== jt) {
|
|
4842
|
+
const K = mt ? re({ value: ht }) : ht;
|
|
4843
|
+
D.text = K, o.textCaseRaw = ht;
|
|
4801
4844
|
} else o.textCaseRaw === void 0 && (o.textCaseRaw = q);
|
|
4802
4845
|
o.uppercase = mt, o.set(D);
|
|
4803
|
-
let
|
|
4846
|
+
let it = !1;
|
|
4804
4847
|
if (_) {
|
|
4805
|
-
const
|
|
4806
|
-
|
|
4807
|
-
} else if (Object.keys(
|
|
4808
|
-
const
|
|
4809
|
-
|
|
4810
|
-
}
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4848
|
+
const K = ae({ textbox: o, styles: G, range: _ }), Ct = W ? ae({ textbox: o, styles: Y, range: W }) : !1;
|
|
4849
|
+
it = K || Ct;
|
|
4850
|
+
} else if (Object.keys(X).length) {
|
|
4851
|
+
const K = cn({ textbox: o });
|
|
4852
|
+
K && (it = ae({ textbox: o, styles: X, range: K }));
|
|
4853
|
+
}
|
|
4854
|
+
const yt = it && P._hasLayoutAffectingStyles({
|
|
4855
|
+
stylesList: [
|
|
4856
|
+
G,
|
|
4857
|
+
Y,
|
|
4858
|
+
X
|
|
4859
|
+
]
|
|
4860
|
+
});
|
|
4861
|
+
it && (o.dirty = !0), yt && (o.initDimensions(), o.dirty = !0), (I !== void 0 || j !== void 0 || A !== void 0 || C !== void 0 || w !== void 0 || T !== void 0 || E !== void 0 || F !== void 0 || x !== void 0 || N !== void 0) && (o.dirty = !0), P._roundTextboxDimensions({ textbox: o }) && (o.dirty = !0), o.setCoords(), n || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
|
|
4862
|
+
const Yt = P._getSnapshot(o);
|
|
4815
4863
|
return a.fire("editor:text-updated", {
|
|
4816
4864
|
textbox: o,
|
|
4817
4865
|
target: t,
|
|
@@ -4822,7 +4870,7 @@ class W {
|
|
|
4822
4870
|
},
|
|
4823
4871
|
updates: D,
|
|
4824
4872
|
before: r,
|
|
4825
|
-
after:
|
|
4873
|
+
after: Yt,
|
|
4826
4874
|
selectionRange: _ != null ? _ : void 0,
|
|
4827
4875
|
selectionStyles: _ && Object.keys(G).length ? G : void 0
|
|
4828
4876
|
}), o;
|
|
@@ -4832,20 +4880,20 @@ class W {
|
|
|
4832
4880
|
*/
|
|
4833
4881
|
destroy() {
|
|
4834
4882
|
const { canvas: t } = this;
|
|
4835
|
-
t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing",
|
|
4883
|
+
t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing", P._handleObjectResizing), t.off("object:modified", this._handleObjectModified), t.off("text:editing:exited", this._handleTextEditingExited), t.off("text:editing:entered", this._handleTextEditingEntered), t.off("text:changed", P._handleTextChanged);
|
|
4836
4884
|
}
|
|
4837
4885
|
/**
|
|
4838
4886
|
* Возвращает активный текст или ищет по id.
|
|
4839
4887
|
*/
|
|
4840
4888
|
_resolveTextObject(t) {
|
|
4841
|
-
if (t instanceof
|
|
4889
|
+
if (t instanceof st) return t;
|
|
4842
4890
|
const { canvas: e } = this;
|
|
4843
4891
|
if (!t) {
|
|
4844
4892
|
const s = e.getActiveObject();
|
|
4845
|
-
return
|
|
4893
|
+
return P._isTextbox(s) ? s : null;
|
|
4846
4894
|
}
|
|
4847
4895
|
if (typeof t == "string") {
|
|
4848
|
-
const s = e.getObjects().find((n) =>
|
|
4896
|
+
const s = e.getObjects().find((n) => P._isTextbox(n) && n.id === t);
|
|
4849
4897
|
return s != null ? s : null;
|
|
4850
4898
|
}
|
|
4851
4899
|
return null;
|
|
@@ -4854,28 +4902,28 @@ class W {
|
|
|
4854
4902
|
* Проверяет, является ли объект текстовым блоком редактора.
|
|
4855
4903
|
*/
|
|
4856
4904
|
static _isTextbox(t) {
|
|
4857
|
-
return !!t && t instanceof
|
|
4905
|
+
return !!t && t instanceof st;
|
|
4858
4906
|
}
|
|
4859
4907
|
/**
|
|
4860
4908
|
* Вешает обработчики событий Fabric для работы с текстом.
|
|
4861
4909
|
*/
|
|
4862
4910
|
_bindEvents() {
|
|
4863
4911
|
const { canvas: t } = this;
|
|
4864
|
-
t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing",
|
|
4912
|
+
t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing", P._handleObjectResizing), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", P._handleTextChanged);
|
|
4865
4913
|
}
|
|
4866
4914
|
/**
|
|
4867
4915
|
* Реагирует на изменение текста в режиме редактирования: синхронизирует textCaseRaw и uppercase.
|
|
4868
4916
|
*/
|
|
4869
4917
|
static _handleTextChanged(t) {
|
|
4870
4918
|
const { target: e } = t;
|
|
4871
|
-
if (!
|
|
4919
|
+
if (!P._isTextbox(e)) return;
|
|
4872
4920
|
const { text: s = "", uppercase: n } = e, o = !!n, i = s.toLocaleLowerCase();
|
|
4873
4921
|
if (o) {
|
|
4874
|
-
const r =
|
|
4922
|
+
const r = re({ value: i });
|
|
4875
4923
|
r !== s && e.set({ text: r }), e.textCaseRaw = i;
|
|
4876
4924
|
} else
|
|
4877
4925
|
e.textCaseRaw = s;
|
|
4878
|
-
|
|
4926
|
+
P._roundTextboxDimensions({ textbox: e }) && (e.setCoords(), e.dirty = !0);
|
|
4879
4927
|
}
|
|
4880
4928
|
/**
|
|
4881
4929
|
* Обрабатывает изменение ширины текстового объекта (resizing).
|
|
@@ -4884,9 +4932,9 @@ class W {
|
|
|
4884
4932
|
* Также корректирует позицию при ресайзе слева, чтобы компенсировать смещение.
|
|
4885
4933
|
*/
|
|
4886
4934
|
static _handleObjectResizing(t) {
|
|
4887
|
-
var l, u,
|
|
4935
|
+
var l, u, f, g, p, m;
|
|
4888
4936
|
const { target: e, transform: s } = t;
|
|
4889
|
-
if (!
|
|
4937
|
+
if (!P._isTextbox(e)) return;
|
|
4890
4938
|
const {
|
|
4891
4939
|
paddingLeft: n = 0,
|
|
4892
4940
|
paddingRight: o = 0
|
|
@@ -4897,7 +4945,7 @@ class W {
|
|
|
4897
4945
|
e.set({ width: r });
|
|
4898
4946
|
const c = (u = e.width) != null ? u : 0, d = a - c;
|
|
4899
4947
|
if (d !== 0 && s && s.corner === "ml") {
|
|
4900
|
-
const M = ((
|
|
4948
|
+
const M = ((f = e.angle) != null ? f : 0) * Math.PI / 180, S = Math.cos(M), y = Math.sin(M), b = (g = e.scaleX) != null ? g : 1, I = d * b;
|
|
4901
4949
|
e.set({
|
|
4902
4950
|
left: ((p = e.left) != null ? p : 0) + I * S,
|
|
4903
4951
|
top: ((m = e.top) != null ? m : 0) + I * y
|
|
@@ -4926,7 +4974,7 @@ class W {
|
|
|
4926
4974
|
textbox: t,
|
|
4927
4975
|
range: e
|
|
4928
4976
|
}) {
|
|
4929
|
-
const s =
|
|
4977
|
+
const s = P._getLineRanges({ textbox: t });
|
|
4930
4978
|
if (!s.length) return e;
|
|
4931
4979
|
let { start: n } = e, { end: o } = e;
|
|
4932
4980
|
return s.forEach(({ start: i, end: a }) => {
|
|
@@ -4944,9 +4992,9 @@ class W {
|
|
|
4944
4992
|
paddingTop: d = 0,
|
|
4945
4993
|
paddingRight: l = 0,
|
|
4946
4994
|
paddingBottom: u = 0,
|
|
4947
|
-
paddingLeft:
|
|
4995
|
+
paddingLeft: f = 0
|
|
4948
4996
|
} = t, {
|
|
4949
|
-
radiusTopLeft:
|
|
4997
|
+
radiusTopLeft: g = 0,
|
|
4950
4998
|
radiusTopRight: p = 0,
|
|
4951
4999
|
radiusBottomRight: m = 0,
|
|
4952
5000
|
radiusBottomLeft: v = 0
|
|
@@ -4959,10 +5007,10 @@ class W {
|
|
|
4959
5007
|
top: d,
|
|
4960
5008
|
right: l,
|
|
4961
5009
|
bottom: u,
|
|
4962
|
-
left:
|
|
5010
|
+
left: f
|
|
4963
5011
|
},
|
|
4964
5012
|
baseRadii: {
|
|
4965
|
-
topLeft:
|
|
5013
|
+
topLeft: g,
|
|
4966
5014
|
topRight: p,
|
|
4967
5015
|
bottomRight: m,
|
|
4968
5016
|
bottomLeft: v
|
|
@@ -4982,16 +5030,39 @@ class W {
|
|
|
4982
5030
|
}) {
|
|
4983
5031
|
return typeof t == "number" ? t : typeof e == "number" ? e : 0;
|
|
4984
5032
|
}
|
|
5033
|
+
/**
|
|
5034
|
+
* Проверяет, есть ли среди стилей свойства, влияющие на перенос строк и высоту текста.
|
|
5035
|
+
*/
|
|
5036
|
+
static _hasLayoutAffectingStyles({
|
|
5037
|
+
stylesList: t
|
|
5038
|
+
}) {
|
|
5039
|
+
const e = t.length;
|
|
5040
|
+
if (!e) return !1;
|
|
5041
|
+
for (let s = 0; s < e; s += 1) {
|
|
5042
|
+
const n = t[s];
|
|
5043
|
+
if (!n) continue;
|
|
5044
|
+
const {
|
|
5045
|
+
fontFamily: o,
|
|
5046
|
+
fontSize: i,
|
|
5047
|
+
fontWeight: a,
|
|
5048
|
+
fontStyle: r,
|
|
5049
|
+
lineHeight: c,
|
|
5050
|
+
charSpacing: d
|
|
5051
|
+
} = n;
|
|
5052
|
+
if (o !== void 0 || i !== void 0 || a !== void 0 || r !== void 0 || c !== void 0 || d !== void 0) return !0;
|
|
5053
|
+
}
|
|
5054
|
+
return !1;
|
|
5055
|
+
}
|
|
4985
5056
|
/**
|
|
4986
5057
|
* Округляет ширину и высоту текстового блока до ближайших целых значений.
|
|
4987
5058
|
*/
|
|
4988
5059
|
static _roundTextboxDimensions({
|
|
4989
5060
|
textbox: t
|
|
4990
5061
|
}) {
|
|
4991
|
-
const { width: e, height: s, calcTextWidth: n, calcTextHeight: o } = t, i = typeof n == "function" ? n.call(t) : void 0, a = typeof o == "function" ? o.call(t) : void 0, r =
|
|
5062
|
+
const { width: e, height: s, calcTextWidth: n, calcTextHeight: o } = t, i = typeof n == "function" ? n.call(t) : void 0, a = typeof o == "function" ? o.call(t) : void 0, r = P._resolveDimension({
|
|
4992
5063
|
rawValue: e,
|
|
4993
5064
|
calculatedValue: i
|
|
4994
|
-
}), c =
|
|
5065
|
+
}), c = P._resolveDimension({
|
|
4995
5066
|
rawValue: s,
|
|
4996
5067
|
calculatedValue: a
|
|
4997
5068
|
}), d = Number.isFinite(r) ? Math.round(r) : null, l = Number.isFinite(c) ? Math.round(c) : null, u = {};
|
|
@@ -5005,8 +5076,8 @@ class W {
|
|
|
5005
5076
|
snapshot: G,
|
|
5006
5077
|
entries: Y
|
|
5007
5078
|
}) => {
|
|
5008
|
-
Object.entries(Y).forEach(([
|
|
5009
|
-
|
|
5079
|
+
Object.entries(Y).forEach(([X, et]) => {
|
|
5080
|
+
et != null && (G[X] = et);
|
|
5010
5081
|
});
|
|
5011
5082
|
}, {
|
|
5012
5083
|
id: s,
|
|
@@ -5019,8 +5090,8 @@ class W {
|
|
|
5019
5090
|
fontStyle: d,
|
|
5020
5091
|
underline: l,
|
|
5021
5092
|
linethrough: u,
|
|
5022
|
-
textAlign:
|
|
5023
|
-
fill:
|
|
5093
|
+
textAlign: f,
|
|
5094
|
+
fill: g,
|
|
5024
5095
|
stroke: p,
|
|
5025
5096
|
strokeWidth: m,
|
|
5026
5097
|
opacity: v,
|
|
@@ -5035,19 +5106,19 @@ class W {
|
|
|
5035
5106
|
radiusBottomRight: w,
|
|
5036
5107
|
radiusBottomLeft: T,
|
|
5037
5108
|
left: E,
|
|
5038
|
-
top:
|
|
5109
|
+
top: F,
|
|
5039
5110
|
width: x,
|
|
5040
5111
|
height: N,
|
|
5041
5112
|
angle: Z,
|
|
5042
5113
|
scaleX: D,
|
|
5043
5114
|
scaleY: _
|
|
5044
|
-
} = t,
|
|
5115
|
+
} = t, W = {
|
|
5045
5116
|
id: s,
|
|
5046
5117
|
uppercase: !!i,
|
|
5047
|
-
textAlign:
|
|
5118
|
+
textAlign: f
|
|
5048
5119
|
};
|
|
5049
5120
|
return e({
|
|
5050
|
-
snapshot:
|
|
5121
|
+
snapshot: W,
|
|
5051
5122
|
entries: {
|
|
5052
5123
|
text: n,
|
|
5053
5124
|
textCaseRaw: o,
|
|
@@ -5057,7 +5128,7 @@ class W {
|
|
|
5057
5128
|
fontStyle: d,
|
|
5058
5129
|
underline: l,
|
|
5059
5130
|
linethrough: u,
|
|
5060
|
-
fill:
|
|
5131
|
+
fill: g,
|
|
5061
5132
|
stroke: p,
|
|
5062
5133
|
strokeWidth: m,
|
|
5063
5134
|
opacity: v,
|
|
@@ -5072,14 +5143,14 @@ class W {
|
|
|
5072
5143
|
radiusBottomRight: w,
|
|
5073
5144
|
radiusBottomLeft: T,
|
|
5074
5145
|
left: E,
|
|
5075
|
-
top:
|
|
5146
|
+
top: F,
|
|
5076
5147
|
width: x,
|
|
5077
5148
|
height: N,
|
|
5078
5149
|
angle: Z,
|
|
5079
5150
|
scaleX: D,
|
|
5080
5151
|
scaleY: _
|
|
5081
5152
|
}
|
|
5082
|
-
}),
|
|
5153
|
+
}), W;
|
|
5083
5154
|
}
|
|
5084
5155
|
/**
|
|
5085
5156
|
* Возвращает первый доступный шрифт или дефолтный Arial.
|
|
@@ -5092,7 +5163,7 @@ class W {
|
|
|
5092
5163
|
const Q = ({
|
|
5093
5164
|
value: h,
|
|
5094
5165
|
fallback: t = 0
|
|
5095
|
-
}) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0,
|
|
5166
|
+
}) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Qt = ({
|
|
5096
5167
|
value: h,
|
|
5097
5168
|
dimension: t,
|
|
5098
5169
|
useRelativePositions: e
|
|
@@ -5109,29 +5180,29 @@ const Q = ({
|
|
|
5109
5180
|
const o = h;
|
|
5110
5181
|
if (typeof o[n.x] == "number" && typeof o[n.y] == "number")
|
|
5111
5182
|
return {
|
|
5112
|
-
x:
|
|
5183
|
+
x: Qt({
|
|
5113
5184
|
value: o[n.x],
|
|
5114
5185
|
dimension: t,
|
|
5115
5186
|
useRelativePositions: s
|
|
5116
5187
|
}),
|
|
5117
|
-
y:
|
|
5188
|
+
y: Qt({
|
|
5118
5189
|
value: o[n.y],
|
|
5119
5190
|
dimension: e,
|
|
5120
5191
|
useRelativePositions: s
|
|
5121
5192
|
})
|
|
5122
5193
|
};
|
|
5123
|
-
const { left: a, top: r, width: c, height: d } = h, l =
|
|
5194
|
+
const { left: a, top: r, width: c, height: d } = h, l = Qt({
|
|
5124
5195
|
value: a,
|
|
5125
5196
|
dimension: t,
|
|
5126
5197
|
useRelativePositions: s
|
|
5127
|
-
}), u =
|
|
5198
|
+
}), u = Qt({
|
|
5128
5199
|
value: r,
|
|
5129
5200
|
dimension: e,
|
|
5130
5201
|
useRelativePositions: s
|
|
5131
|
-
}),
|
|
5202
|
+
}), f = Q({ value: c }) / (t || 1), g = Q({ value: d }) / (e || 1);
|
|
5132
5203
|
return {
|
|
5133
|
-
x: l +
|
|
5134
|
-
y: u +
|
|
5204
|
+
x: l + f / 2,
|
|
5205
|
+
y: u + g / 2
|
|
5135
5206
|
};
|
|
5136
5207
|
}, hn = ({
|
|
5137
5208
|
normalizedX: h,
|
|
@@ -5142,11 +5213,11 @@ const Q = ({
|
|
|
5142
5213
|
}) => {
|
|
5143
5214
|
const { left: o, top: i, width: a, height: r } = e;
|
|
5144
5215
|
if (!n) {
|
|
5145
|
-
const { width: l, height: u } = s,
|
|
5146
|
-
return new
|
|
5216
|
+
const { width: l, height: u } = s, f = o + h * (l || a), g = i + t * (u || r);
|
|
5217
|
+
return new tt(f, g);
|
|
5147
5218
|
}
|
|
5148
5219
|
const c = o + h * a, d = i + t * r;
|
|
5149
|
-
return new
|
|
5220
|
+
return new tt(c, d);
|
|
5150
5221
|
}, un = ({
|
|
5151
5222
|
object: h,
|
|
5152
5223
|
montageArea: t,
|
|
@@ -5185,12 +5256,12 @@ const Q = ({
|
|
|
5185
5256
|
} catch (t) {
|
|
5186
5257
|
return null;
|
|
5187
5258
|
}
|
|
5188
|
-
},
|
|
5259
|
+
}, fn = ({
|
|
5189
5260
|
x1: h,
|
|
5190
5261
|
y1: t,
|
|
5191
5262
|
x2: e,
|
|
5192
5263
|
y2: s
|
|
5193
|
-
}) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360,
|
|
5264
|
+
}) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, gn = (h) => {
|
|
5194
5265
|
if (!h || typeof h != "object") return null;
|
|
5195
5266
|
const { type: t, coords: e, colorStops: s } = h, n = Array.isArray(s) ? s : [], o = n[0], i = n[n.length - 1], a = typeof (o == null ? void 0 : o.color) == "string" ? o.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (o == null ? void 0 : o.offset) == "number" ? o.offset * 100 : void 0, d = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0, l = n.map((u) => ({
|
|
5196
5267
|
color: typeof u.color == "string" ? u.color : "#000000",
|
|
@@ -5198,11 +5269,11 @@ const Q = ({
|
|
|
5198
5269
|
}));
|
|
5199
5270
|
if (!a || !r || !e) return null;
|
|
5200
5271
|
if (t === "linear") {
|
|
5201
|
-
const { x1: u, y1:
|
|
5202
|
-
if (typeof u == "number" && typeof
|
|
5272
|
+
const { x1: u, y1: f, x2: g, y2: p } = e;
|
|
5273
|
+
if (typeof u == "number" && typeof f == "number" && typeof g == "number" && typeof p == "number")
|
|
5203
5274
|
return {
|
|
5204
5275
|
type: "linear",
|
|
5205
|
-
angle:
|
|
5276
|
+
angle: fn({ x1: u, y1: f, x2: g, y2: p }),
|
|
5206
5277
|
startColor: a,
|
|
5207
5278
|
endColor: r,
|
|
5208
5279
|
startPosition: c,
|
|
@@ -5211,13 +5282,13 @@ const Q = ({
|
|
|
5211
5282
|
};
|
|
5212
5283
|
}
|
|
5213
5284
|
if (t === "radial") {
|
|
5214
|
-
const { x1: u, y1:
|
|
5215
|
-
if (typeof u == "number" && typeof
|
|
5285
|
+
const { x1: u, y1: f, r2: g } = e;
|
|
5286
|
+
if (typeof u == "number" && typeof f == "number" && typeof g == "number")
|
|
5216
5287
|
return {
|
|
5217
5288
|
type: "radial",
|
|
5218
5289
|
centerX: u * 100,
|
|
5219
|
-
centerY:
|
|
5220
|
-
radius:
|
|
5290
|
+
centerY: f * 100,
|
|
5291
|
+
radius: g * 100,
|
|
5221
5292
|
startColor: a,
|
|
5222
5293
|
endColor: r,
|
|
5223
5294
|
startPosition: c,
|
|
@@ -5226,7 +5297,7 @@ const Q = ({
|
|
|
5226
5297
|
};
|
|
5227
5298
|
}
|
|
5228
5299
|
return null;
|
|
5229
|
-
},
|
|
5300
|
+
}, Pt = "_templateCenterX", ce = "_templateCenterY", qt = "_templateAnchorX", de = "_templateAnchorY";
|
|
5230
5301
|
class R {
|
|
5231
5302
|
constructor({ editor: t }) {
|
|
5232
5303
|
this.editor = t;
|
|
@@ -5246,21 +5317,21 @@ class R {
|
|
|
5246
5317
|
montageArea: i,
|
|
5247
5318
|
errorManager: a,
|
|
5248
5319
|
backgroundManager: r
|
|
5249
|
-
} = this.editor, c = o.getActiveObject(), d = R._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = n && l ? [l] : [],
|
|
5250
|
-
if (!
|
|
5320
|
+
} = this.editor, c = o.getActiveObject(), d = R._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = n && l ? [l] : [], f = [...d, ...u];
|
|
5321
|
+
if (!f.length)
|
|
5251
5322
|
return a.emitWarning({
|
|
5252
5323
|
origin: "TemplateManager",
|
|
5253
5324
|
method: "serializeSelection",
|
|
5254
|
-
code:
|
|
5325
|
+
code: wt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
5255
5326
|
message: "Нет объектов для сериализации шаблона"
|
|
5256
5327
|
}), null;
|
|
5257
|
-
const
|
|
5328
|
+
const g = R._getBounds(i), p = R._getMontageSize({ montageArea: i, bounds: g }), m = p.width, v = p.height, M = f.map((b) => R._serializeObject({
|
|
5258
5329
|
object: b,
|
|
5259
|
-
bounds:
|
|
5330
|
+
bounds: g,
|
|
5260
5331
|
baseWidth: m,
|
|
5261
5332
|
baseHeight: v,
|
|
5262
5333
|
montageArea: i != null ? i : null
|
|
5263
|
-
})), S =
|
|
5334
|
+
})), S = bt(B({}, s), {
|
|
5264
5335
|
baseWidth: m,
|
|
5265
5336
|
baseHeight: v,
|
|
5266
5337
|
positionsNormalized: !0,
|
|
@@ -5294,7 +5365,7 @@ class R {
|
|
|
5294
5365
|
return a.emitWarning({
|
|
5295
5366
|
origin: "TemplateManager",
|
|
5296
5367
|
method: "applyTemplate",
|
|
5297
|
-
code:
|
|
5368
|
+
code: wt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
5298
5369
|
message: "Шаблон не содержит объектов"
|
|
5299
5370
|
}), null;
|
|
5300
5371
|
const u = R._getBounds(o);
|
|
@@ -5302,10 +5373,10 @@ class R {
|
|
|
5302
5373
|
return a.emitWarning({
|
|
5303
5374
|
origin: "TemplateManager",
|
|
5304
5375
|
method: "applyTemplate",
|
|
5305
|
-
code:
|
|
5376
|
+
code: wt.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
5306
5377
|
message: "Не удалось определить границы монтажной области"
|
|
5307
5378
|
}), null;
|
|
5308
|
-
const
|
|
5379
|
+
const f = R._getMontageSize({ montageArea: o, bounds: u }), g = R._normalizeMeta({ meta: d, fallback: f }), p = R._calculateScale({ meta: g, target: f }), m = !!g.positionsNormalized;
|
|
5309
5380
|
let v = !1, M = !1;
|
|
5310
5381
|
i.suspendHistory();
|
|
5311
5382
|
try {
|
|
@@ -5314,7 +5385,7 @@ class R {
|
|
|
5314
5385
|
return a.emitWarning({
|
|
5315
5386
|
origin: "TemplateManager",
|
|
5316
5387
|
method: "applyTemplate",
|
|
5317
|
-
code:
|
|
5388
|
+
code: wt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
5318
5389
|
message: "Не удалось создать объекты шаблона"
|
|
5319
5390
|
}), null;
|
|
5320
5391
|
const { backgroundObject: y, contentObjects: b } = R._extractBackgroundObject(S);
|
|
@@ -5325,14 +5396,14 @@ class R {
|
|
|
5325
5396
|
}));
|
|
5326
5397
|
const I = b.map((j) => (this._adaptTextboxWidth({
|
|
5327
5398
|
object: j,
|
|
5328
|
-
baseWidth:
|
|
5399
|
+
baseWidth: g.baseWidth
|
|
5329
5400
|
}), R._transformObject({
|
|
5330
5401
|
object: j,
|
|
5331
5402
|
scale: p,
|
|
5332
5403
|
bounds: u,
|
|
5333
|
-
targetSize:
|
|
5334
|
-
baseWidth:
|
|
5335
|
-
baseHeight:
|
|
5404
|
+
targetSize: f,
|
|
5405
|
+
baseWidth: g.baseWidth,
|
|
5406
|
+
baseHeight: g.baseHeight,
|
|
5336
5407
|
montageArea: o,
|
|
5337
5408
|
useRelativePositions: m
|
|
5338
5409
|
}), j.set({
|
|
@@ -5348,7 +5419,7 @@ class R {
|
|
|
5348
5419
|
return a.emitError({
|
|
5349
5420
|
origin: "TemplateManager",
|
|
5350
5421
|
method: "applyTemplate",
|
|
5351
|
-
code:
|
|
5422
|
+
code: wt.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
5352
5423
|
message: "Ошибка применения шаблона",
|
|
5353
5424
|
data: {
|
|
5354
5425
|
templateId: l,
|
|
@@ -5395,7 +5466,7 @@ class R {
|
|
|
5395
5466
|
if (i)
|
|
5396
5467
|
return R._restoreImageScale({ revived: i, serialized: s }), i;
|
|
5397
5468
|
}
|
|
5398
|
-
const n = yield
|
|
5469
|
+
const n = yield lt.enlivenObjects([s]), o = n == null ? void 0 : n[0];
|
|
5399
5470
|
return o ? (R._restoreImageScale({ revived: o, serialized: s }), o) : null;
|
|
5400
5471
|
})))).filter((s) => !!s);
|
|
5401
5472
|
});
|
|
@@ -5417,14 +5488,14 @@ class R {
|
|
|
5417
5488
|
} = e, c = t, d = "getElement" in c && typeof c.getElement == "function" ? c.getElement() : null, {
|
|
5418
5489
|
naturalWidth: l = 0,
|
|
5419
5490
|
naturalHeight: u = 0,
|
|
5420
|
-
width:
|
|
5421
|
-
height:
|
|
5491
|
+
width: f = 0,
|
|
5492
|
+
height: g = 0
|
|
5422
5493
|
} = d instanceof HTMLImageElement ? d : {
|
|
5423
5494
|
naturalWidth: 0,
|
|
5424
5495
|
naturalHeight: 0,
|
|
5425
5496
|
width: 0,
|
|
5426
5497
|
height: 0
|
|
5427
|
-
}, p = Q({ value: l ||
|
|
5498
|
+
}, p = Q({ value: l || f || c.width, fallback: 0 }), m = Q({ value: u || g || c.height, fallback: 0 }), v = Q({ value: n, fallback: p }), M = Q({ value: o, fallback: m }), S = Q({ value: i, fallback: c.scaleX || 1 }), y = Q({ value: a, fallback: c.scaleY || 1 }), b = v * S, I = M * y, j = p > 0, A = m > 0, C = b > 0, w = I > 0, T = R._resolveImageFit({ customData: r }), E = {};
|
|
5428
5499
|
if (j && (E.width = p), A && (E.height = m), !j || !A) {
|
|
5429
5500
|
c.set(E);
|
|
5430
5501
|
return;
|
|
@@ -5438,8 +5509,8 @@ class R {
|
|
|
5438
5509
|
c.set(E);
|
|
5439
5510
|
return;
|
|
5440
5511
|
}
|
|
5441
|
-
const
|
|
5442
|
-
Number.isFinite(
|
|
5512
|
+
const F = Math.min(b / p, I / m);
|
|
5513
|
+
Number.isFinite(F) && F > 0 && (E.scaleX = F, E.scaleY = F), c.set(E);
|
|
5443
5514
|
}
|
|
5444
5515
|
/**
|
|
5445
5516
|
* Определяет режим вписывания изображения при восстановлении.
|
|
@@ -5465,7 +5536,7 @@ class R {
|
|
|
5465
5536
|
const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
|
|
5466
5537
|
if (!e) return null;
|
|
5467
5538
|
try {
|
|
5468
|
-
const s = yield ms(e), n =
|
|
5539
|
+
const s = yield ms(e), n = lt.groupSVGElements(s.objects, s.options), o = yield lt.enlivenObjectEnlivables(
|
|
5469
5540
|
R._prepareSerializableProps(t)
|
|
5470
5541
|
);
|
|
5471
5542
|
return n.set(o), n.setCoords(), n;
|
|
@@ -5530,28 +5601,28 @@ class R {
|
|
|
5530
5601
|
baseHeight: i,
|
|
5531
5602
|
useRelativePositions: r,
|
|
5532
5603
|
centerKeys: {
|
|
5533
|
-
x:
|
|
5534
|
-
y:
|
|
5604
|
+
x: Pt,
|
|
5605
|
+
y: ce
|
|
5535
5606
|
}
|
|
5536
|
-
}), { scaleX: u, scaleY:
|
|
5607
|
+
}), { scaleX: u, scaleY: f } = t, g = Q({ value: u, fallback: 1 }), p = Q({ value: f, fallback: 1 }), m = R._getPositioningBounds({
|
|
5537
5608
|
bounds: s,
|
|
5538
5609
|
baseWidth: o,
|
|
5539
5610
|
baseHeight: i,
|
|
5540
5611
|
scale: e,
|
|
5541
5612
|
useRelativePositions: r,
|
|
5542
|
-
anchorX: R._resolveAnchor(c,
|
|
5543
|
-
anchorY: R._resolveAnchor(c,
|
|
5613
|
+
anchorX: R._resolveAnchor(c, qt),
|
|
5614
|
+
anchorY: R._resolveAnchor(c, de)
|
|
5544
5615
|
}), v = hn({
|
|
5545
5616
|
normalizedX: d,
|
|
5546
5617
|
normalizedY: l,
|
|
5547
5618
|
bounds: m,
|
|
5548
5619
|
targetSize: n,
|
|
5549
5620
|
montageArea: a
|
|
5550
|
-
}), M =
|
|
5621
|
+
}), M = g * e, S = p * e;
|
|
5551
5622
|
t.set({
|
|
5552
5623
|
scaleX: M,
|
|
5553
5624
|
scaleY: S
|
|
5554
|
-
}), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[
|
|
5625
|
+
}), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[Pt], delete c[ce], delete c[qt], delete c[de];
|
|
5555
5626
|
}
|
|
5556
5627
|
/**
|
|
5557
5628
|
* Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
|
|
@@ -5567,10 +5638,10 @@ class R {
|
|
|
5567
5638
|
anchorY: a
|
|
5568
5639
|
}) {
|
|
5569
5640
|
if (!o) return t;
|
|
5570
|
-
const r = (e || t.width) * n, c = (s || t.height) * n, d = t.width - r, l = t.height - c, u = t.left + R._calculateAnchorOffset(i, d),
|
|
5641
|
+
const r = (e || t.width) * n, c = (s || t.height) * n, d = t.width - r, l = t.height - c, u = t.left + R._calculateAnchorOffset(i, d), f = t.top + R._calculateAnchorOffset(a, l);
|
|
5571
5642
|
return {
|
|
5572
5643
|
left: u,
|
|
5573
|
-
top:
|
|
5644
|
+
top: f,
|
|
5574
5645
|
width: r,
|
|
5575
5646
|
height: c
|
|
5576
5647
|
};
|
|
@@ -5598,7 +5669,7 @@ class R {
|
|
|
5598
5669
|
meta: t,
|
|
5599
5670
|
fallback: e
|
|
5600
5671
|
}) {
|
|
5601
|
-
const { width: s, height: n } = e, r = t || {}, { baseWidth: o = s, baseHeight: i = n } = r, a =
|
|
5672
|
+
const { width: s, height: n } = e, r = t || {}, { baseWidth: o = s, baseHeight: i = n } = r, a = Mt(r, ["baseWidth", "baseHeight"]);
|
|
5602
5673
|
return B({
|
|
5603
5674
|
baseWidth: o,
|
|
5604
5675
|
baseHeight: i
|
|
@@ -5637,7 +5708,7 @@ class R {
|
|
|
5637
5708
|
baseWidth: e
|
|
5638
5709
|
}) {
|
|
5639
5710
|
var Z, D;
|
|
5640
|
-
if (!(t instanceof
|
|
5711
|
+
if (!(t instanceof st)) return;
|
|
5641
5712
|
const s = typeof t.text == "string" ? t.text : "";
|
|
5642
5713
|
if (!s) return;
|
|
5643
5714
|
const n = Q({
|
|
@@ -5647,19 +5718,19 @@ class R {
|
|
|
5647
5718
|
width: o = 0,
|
|
5648
5719
|
scaleX: i = 1,
|
|
5649
5720
|
strokeWidth: a = 0
|
|
5650
|
-
} = t, r = Q({ value: e, fallback: 0 }), c = t, d = Q({ value: c.paddingLeft, fallback: 0 }), l = Q({ value: c.paddingRight, fallback: 0 }), u = Q({ value: i, fallback: 1 }),
|
|
5651
|
-
if (!n || !
|
|
5721
|
+
} = t, r = Q({ value: e, fallback: 0 }), c = t, d = Q({ value: c.paddingLeft, fallback: 0 }), l = Q({ value: c.paddingRight, fallback: 0 }), u = Q({ value: i, fallback: 1 }), f = Q({ value: a, fallback: 0 }) * u, g = Q({ value: o, fallback: 0 }), p = g * u, m = d * u, v = l * u, M = p + m + v + f;
|
|
5722
|
+
if (!n || !g || !r) return;
|
|
5652
5723
|
t.setCoords();
|
|
5653
|
-
const S = t, y = S[
|
|
5724
|
+
const S = t, y = S[Pt], b = typeof y == "number" ? y : null, I = R._resolveAnchor(S, qt), j = M / r, A = b !== null ? b - j / 2 : null, C = b !== null ? b + j / 2 : null, w = t.getCenterPoint();
|
|
5654
5725
|
t.set("width", n), t.initDimensions();
|
|
5655
5726
|
const T = R._getLongestLineWidth({
|
|
5656
5727
|
textbox: t,
|
|
5657
5728
|
text: s
|
|
5658
|
-
}), E = T >
|
|
5729
|
+
}), E = T > g ? T + 1 : g;
|
|
5659
5730
|
t.set("width", E), t.initDimensions(), t.setPositionByOrigin(w, "center", "center"), t.setCoords();
|
|
5660
|
-
const x = (E * u + m + v +
|
|
5731
|
+
const x = (E * u + m + v + f) / r;
|
|
5661
5732
|
let N = b;
|
|
5662
|
-
I === "start" && A !== null ? N = Math.max(0, A) + x / 2 : I === "end" && C !== null && (N = Math.min(1, C) - x / 2), typeof N == "number" && (S[
|
|
5733
|
+
I === "start" && A !== null ? N = Math.max(0, A) + x / 2 : I === "end" && C !== null && (N = Math.min(1, C) - x / 2), typeof N == "number" && (S[Pt] = N);
|
|
5663
5734
|
}
|
|
5664
5735
|
/**
|
|
5665
5736
|
* Возвращает ширину самой длинной строки текстового объекта.
|
|
@@ -5700,22 +5771,22 @@ class R {
|
|
|
5700
5771
|
top: r,
|
|
5701
5772
|
width: c,
|
|
5702
5773
|
height: d
|
|
5703
|
-
} = e, l = t.getBoundingRect(!1, !0), u = s || c || 1,
|
|
5774
|
+
} = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, f = n || d || 1, g = un({
|
|
5704
5775
|
object: t,
|
|
5705
5776
|
montageArea: o,
|
|
5706
5777
|
bounds: e
|
|
5707
|
-
}), p =
|
|
5778
|
+
}), p = g != null ? g : (() => {
|
|
5708
5779
|
const y = t.getCenterPoint();
|
|
5709
5780
|
return {
|
|
5710
5781
|
x: (y.x - a) / u,
|
|
5711
|
-
y: (y.y - r) /
|
|
5782
|
+
y: (y.y - r) / f
|
|
5712
5783
|
};
|
|
5713
|
-
})(), m = (l.left - a) / u, v = (l.top - r) /
|
|
5714
|
-
return i[
|
|
5784
|
+
})(), m = (l.left - a) / u, v = (l.top - r) / f, M = m + l.width / u, S = v + l.height / f;
|
|
5785
|
+
return i[Pt] = p.x, i[ce] = p.y, i[qt] = R._detectAnchor({
|
|
5715
5786
|
center: p.x,
|
|
5716
5787
|
start: m,
|
|
5717
5788
|
end: M
|
|
5718
|
-
}), i[
|
|
5789
|
+
}), i[de] = R._detectAnchor({
|
|
5719
5790
|
center: p.y,
|
|
5720
5791
|
start: v,
|
|
5721
5792
|
end: S
|
|
@@ -5750,7 +5821,7 @@ class R {
|
|
|
5750
5821
|
withoutSave: !0
|
|
5751
5822
|
}), !0;
|
|
5752
5823
|
if (a === "gradient") {
|
|
5753
|
-
const c =
|
|
5824
|
+
const c = gn(o);
|
|
5754
5825
|
if (c)
|
|
5755
5826
|
return e.setGradientBackground({
|
|
5756
5827
|
gradient: c,
|
|
@@ -5773,7 +5844,7 @@ class R {
|
|
|
5773
5844
|
s.emitWarning({
|
|
5774
5845
|
origin: "TemplateManager",
|
|
5775
5846
|
method: "applyTemplate",
|
|
5776
|
-
code:
|
|
5847
|
+
code: wt.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
5777
5848
|
message: "Не удалось применить фон из шаблона",
|
|
5778
5849
|
data: o
|
|
5779
5850
|
});
|
|
@@ -5829,10 +5900,10 @@ class R {
|
|
|
5829
5900
|
*/
|
|
5830
5901
|
// eslint-disable-next-line class-methods-use-this
|
|
5831
5902
|
enlivenObjectEnlivables(t) {
|
|
5832
|
-
return
|
|
5903
|
+
return lt.enlivenObjectEnlivables(t);
|
|
5833
5904
|
}
|
|
5834
5905
|
}
|
|
5835
|
-
const pn = 5, ss = "#3D8BF4",
|
|
5906
|
+
const pn = 5, ss = "#3D8BF4", pe = 1, Jt = 1, Ke = ({
|
|
5836
5907
|
anchors: h,
|
|
5837
5908
|
positions: t,
|
|
5838
5909
|
threshold: e
|
|
@@ -5889,8 +5960,8 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
5889
5960
|
for (const d of s)
|
|
5890
5961
|
for (const l of t)
|
|
5891
5962
|
if (n === "vertical") {
|
|
5892
|
-
const u = o - l.bottom,
|
|
5893
|
-
if (
|
|
5963
|
+
const u = o - l.bottom, f = Math.abs(u - d.distance);
|
|
5964
|
+
if (f <= e) {
|
|
5894
5965
|
const m = d.distance - u, v = {
|
|
5895
5966
|
type: n,
|
|
5896
5967
|
axis: d.axis,
|
|
@@ -5900,11 +5971,11 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
5900
5971
|
activeEnd: l.bottom + d.distance,
|
|
5901
5972
|
distance: d.distance
|
|
5902
5973
|
};
|
|
5903
|
-
c.push({ delta: m, guide: v, diff:
|
|
5974
|
+
c.push({ delta: m, guide: v, diff: f });
|
|
5904
5975
|
}
|
|
5905
|
-
const
|
|
5976
|
+
const g = l.top - i, p = Math.abs(g - d.distance);
|
|
5906
5977
|
if (p <= e) {
|
|
5907
|
-
const m = d.distance -
|
|
5978
|
+
const m = d.distance - g, v = {
|
|
5908
5979
|
type: n,
|
|
5909
5980
|
axis: d.axis,
|
|
5910
5981
|
refStart: d.start,
|
|
@@ -5916,8 +5987,8 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
5916
5987
|
c.push({ delta: m, guide: v, diff: p });
|
|
5917
5988
|
}
|
|
5918
5989
|
} else {
|
|
5919
|
-
const u = a - l.right,
|
|
5920
|
-
if (
|
|
5990
|
+
const u = a - l.right, f = Math.abs(u - d.distance);
|
|
5991
|
+
if (f <= e) {
|
|
5921
5992
|
const m = d.distance - u, v = {
|
|
5922
5993
|
type: n,
|
|
5923
5994
|
axis: d.axis,
|
|
@@ -5927,11 +5998,11 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
5927
5998
|
activeEnd: l.right + d.distance,
|
|
5928
5999
|
distance: d.distance
|
|
5929
6000
|
};
|
|
5930
|
-
c.push({ delta: m, guide: v, diff:
|
|
6001
|
+
c.push({ delta: m, guide: v, diff: f });
|
|
5931
6002
|
}
|
|
5932
|
-
const
|
|
6003
|
+
const g = l.left - r, p = Math.abs(g - d.distance);
|
|
5933
6004
|
if (p <= e) {
|
|
5934
|
-
const m = d.distance -
|
|
6005
|
+
const m = d.distance - g, v = {
|
|
5935
6006
|
type: n,
|
|
5936
6007
|
axis: d.axis,
|
|
5937
6008
|
refStart: d.start,
|
|
@@ -5967,9 +6038,9 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
5967
6038
|
const l = d.findIndex((y) => y.isActive);
|
|
5968
6039
|
if (l === -1)
|
|
5969
6040
|
return { delta: 0, guide: null };
|
|
5970
|
-
const u = d[l - 1],
|
|
5971
|
-
if (u &&
|
|
5972
|
-
const { bounds: y } = u, { bounds: b } =
|
|
6041
|
+
const u = d[l - 1], f = d[l - 2], g = d[l + 1], p = d[l + 2], m = [], v = i - o;
|
|
6042
|
+
if (u && f) {
|
|
6043
|
+
const { bounds: y } = u, { bounds: b } = f, I = y.top - b.bottom, j = o - y.bottom, A = Math.abs(j - I);
|
|
5973
6044
|
if (A <= e) {
|
|
5974
6045
|
const C = I - j, w = o + C, T = {
|
|
5975
6046
|
type: "vertical",
|
|
@@ -5983,8 +6054,8 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
5983
6054
|
m.push({ delta: C, guide: T, diff: A });
|
|
5984
6055
|
}
|
|
5985
6056
|
}
|
|
5986
|
-
if (
|
|
5987
|
-
const { bounds: y } =
|
|
6057
|
+
if (g && p) {
|
|
6058
|
+
const { bounds: y } = g, { bounds: b } = p, I = b.top - y.bottom, j = y.top - i, A = Math.abs(j - I);
|
|
5988
6059
|
if (A <= e) {
|
|
5989
6060
|
const C = j - I, w = i + C, T = {
|
|
5990
6061
|
type: "vertical",
|
|
@@ -5998,11 +6069,11 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
5998
6069
|
m.push({ delta: C, guide: T, diff: A });
|
|
5999
6070
|
}
|
|
6000
6071
|
}
|
|
6001
|
-
if (u &&
|
|
6002
|
-
const { bounds: y } = u, { bounds: b } =
|
|
6072
|
+
if (u && g) {
|
|
6073
|
+
const { bounds: y } = u, { bounds: b } = g, j = b.top - y.bottom - v;
|
|
6003
6074
|
if (j >= 0) {
|
|
6004
|
-
const A = j / 2, C = o - y.bottom, w = b.top - i, T = Math.abs(C - A), E = Math.abs(w - A),
|
|
6005
|
-
if (
|
|
6075
|
+
const A = j / 2, C = o - y.bottom, w = b.top - i, T = Math.abs(C - A), E = Math.abs(w - A), F = Math.max(T, E);
|
|
6076
|
+
if (F <= e) {
|
|
6006
6077
|
const x = A - C, N = i + x, Z = {
|
|
6007
6078
|
type: "vertical",
|
|
6008
6079
|
axis: n,
|
|
@@ -6012,7 +6083,7 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6012
6083
|
activeEnd: N + A,
|
|
6013
6084
|
distance: A
|
|
6014
6085
|
};
|
|
6015
|
-
m.push({ delta: x, guide: Z, diff:
|
|
6086
|
+
m.push({ delta: x, guide: Z, diff: F });
|
|
6016
6087
|
}
|
|
6017
6088
|
}
|
|
6018
6089
|
}
|
|
@@ -6053,9 +6124,9 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6053
6124
|
const l = d.findIndex((y) => y.isActive);
|
|
6054
6125
|
if (l === -1)
|
|
6055
6126
|
return { delta: 0, guide: null };
|
|
6056
|
-
const u = d[l - 1],
|
|
6057
|
-
if (u &&
|
|
6058
|
-
const { bounds: y } = u, { bounds: b } =
|
|
6127
|
+
const u = d[l - 1], f = d[l - 2], g = d[l + 1], p = d[l + 2], m = [], v = i - o;
|
|
6128
|
+
if (u && f) {
|
|
6129
|
+
const { bounds: y } = u, { bounds: b } = f, I = y.left - b.right, j = o - y.right, A = Math.abs(j - I);
|
|
6059
6130
|
if (A <= e) {
|
|
6060
6131
|
const C = I - j, w = o + C, T = {
|
|
6061
6132
|
type: "horizontal",
|
|
@@ -6069,8 +6140,8 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6069
6140
|
m.push({ delta: C, guide: T, diff: A });
|
|
6070
6141
|
}
|
|
6071
6142
|
}
|
|
6072
|
-
if (
|
|
6073
|
-
const { bounds: y } =
|
|
6143
|
+
if (g && p) {
|
|
6144
|
+
const { bounds: y } = g, { bounds: b } = p, I = b.left - y.right, j = y.left - i, A = Math.abs(j - I);
|
|
6074
6145
|
if (A <= e) {
|
|
6075
6146
|
const C = j - I, w = i + C, T = {
|
|
6076
6147
|
type: "horizontal",
|
|
@@ -6084,11 +6155,11 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6084
6155
|
m.push({ delta: C, guide: T, diff: A });
|
|
6085
6156
|
}
|
|
6086
6157
|
}
|
|
6087
|
-
if (u &&
|
|
6088
|
-
const { bounds: y } = u, { bounds: b } =
|
|
6158
|
+
if (u && g) {
|
|
6159
|
+
const { bounds: y } = u, { bounds: b } = g, j = b.left - y.right - v;
|
|
6089
6160
|
if (j >= 0) {
|
|
6090
|
-
const A = j / 2, C = o - y.right, w = b.left - i, T = Math.abs(C - A), E = Math.abs(w - A),
|
|
6091
|
-
if (
|
|
6161
|
+
const A = j / 2, C = o - y.right, w = b.left - i, T = Math.abs(C - A), E = Math.abs(w - A), F = Math.max(T, E);
|
|
6162
|
+
if (F <= e) {
|
|
6092
6163
|
const x = A - C, N = i + x, Z = {
|
|
6093
6164
|
type: "horizontal",
|
|
6094
6165
|
axis: n,
|
|
@@ -6098,7 +6169,7 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6098
6169
|
activeEnd: N + A,
|
|
6099
6170
|
distance: A
|
|
6100
6171
|
};
|
|
6101
|
-
m.push({ delta: x, guide: Z, diff:
|
|
6172
|
+
m.push({ delta: x, guide: Z, diff: F });
|
|
6102
6173
|
}
|
|
6103
6174
|
}
|
|
6104
6175
|
}
|
|
@@ -6148,7 +6219,7 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6148
6219
|
}) => {
|
|
6149
6220
|
const i = Math.min(o, s / 2, n / 2);
|
|
6150
6221
|
h.moveTo(t + i, e), h.lineTo(t + s - i, e), h.quadraticCurveTo(t + s, e, t + s, e + i), h.lineTo(t + s, e + n - i), h.quadraticCurveTo(t + s, e + n, t + s - i, e + n), h.lineTo(t + i, e + n), h.quadraticCurveTo(t, e + n, t, e + n - i), h.lineTo(t, e + i), h.quadraticCurveTo(t, e, t + i, e), h.closePath();
|
|
6151
|
-
},
|
|
6222
|
+
}, me = ({
|
|
6152
6223
|
context: h,
|
|
6153
6224
|
type: t,
|
|
6154
6225
|
axis: e,
|
|
@@ -6162,10 +6233,10 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6162
6233
|
lineWidth: d = 1,
|
|
6163
6234
|
padding: l = 4,
|
|
6164
6235
|
radius: u = 4,
|
|
6165
|
-
offsetAlongAxis:
|
|
6166
|
-
offsetPerpendicular:
|
|
6236
|
+
offsetAlongAxis: f = 0,
|
|
6237
|
+
offsetPerpendicular: g = 0
|
|
6167
6238
|
}) => {
|
|
6168
|
-
const p = i || 1, m = 12 / p, v = l / p, M = u / p, S = (s + n) / 2 +
|
|
6239
|
+
const p = i || 1, m = 12 / p, v = l / p, M = u / p, S = (s + n) / 2 + f, y = t === "vertical" ? e + g : S, b = t === "vertical" ? S : e + g;
|
|
6169
6240
|
h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = d / p, h.font = `${m}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
|
|
6170
6241
|
const j = h.measureText(o).width + v * 2, A = m + v * 2, C = y - j / 2, w = b - A / 2;
|
|
6171
6242
|
h.beginPath(), Mn({
|
|
@@ -6192,7 +6263,7 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6192
6263
|
} = t, d = Math.round(c).toString();
|
|
6193
6264
|
h.beginPath(), s === "vertical" ? (h.moveTo(n, o), h.lineTo(n, i), h.moveTo(n, a), h.lineTo(n, r)) : (h.moveTo(o, n), h.lineTo(i, n), h.moveTo(a, n), h.lineTo(r, n)), h.stroke();
|
|
6194
6265
|
const l = ss;
|
|
6195
|
-
|
|
6266
|
+
me({
|
|
6196
6267
|
context: h,
|
|
6197
6268
|
type: s,
|
|
6198
6269
|
axis: n,
|
|
@@ -6201,8 +6272,8 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6201
6272
|
text: d,
|
|
6202
6273
|
zoom: e,
|
|
6203
6274
|
color: l,
|
|
6204
|
-
lineWidth:
|
|
6205
|
-
}),
|
|
6275
|
+
lineWidth: pe
|
|
6276
|
+
}), me({
|
|
6206
6277
|
context: h,
|
|
6207
6278
|
type: s,
|
|
6208
6279
|
axis: n,
|
|
@@ -6211,7 +6282,7 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6211
6282
|
text: d,
|
|
6212
6283
|
zoom: e,
|
|
6213
6284
|
color: l,
|
|
6214
|
-
lineWidth:
|
|
6285
|
+
lineWidth: pe
|
|
6215
6286
|
});
|
|
6216
6287
|
}, Qe = ({
|
|
6217
6288
|
anchors: h,
|
|
@@ -6243,10 +6314,10 @@ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
|
|
|
6243
6314
|
M < 0 || M < l && (l = M, d = m);
|
|
6244
6315
|
}
|
|
6245
6316
|
if (!d || l === Number.POSITIVE_INFINITY) continue;
|
|
6246
|
-
const u = Math.max(c[o], d[o]),
|
|
6317
|
+
const u = Math.max(c[o], d[o]), f = Math.min(c[i], d[i]), g = (u + f) / 2;
|
|
6247
6318
|
n.push({
|
|
6248
6319
|
type: t,
|
|
6249
|
-
axis:
|
|
6320
|
+
axis: g,
|
|
6250
6321
|
start: c[s],
|
|
6251
6322
|
end: d[e],
|
|
6252
6323
|
distance: d[e] - c[s]
|
|
@@ -6359,22 +6430,22 @@ class jn {
|
|
|
6359
6430
|
top: M + l
|
|
6360
6431
|
}), e.setCoords(), o = (p = pt({ object: e })) != null ? p : o;
|
|
6361
6432
|
}
|
|
6362
|
-
const
|
|
6433
|
+
const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => pt({ object: v })).filter((v) => !!v), g = bn({
|
|
6363
6434
|
activeBounds: o,
|
|
6364
|
-
candidates:
|
|
6435
|
+
candidates: f,
|
|
6365
6436
|
threshold: r,
|
|
6366
6437
|
spacingPatterns: this.spacingPatterns
|
|
6367
6438
|
});
|
|
6368
|
-
if (
|
|
6439
|
+
if (g.deltaX !== 0 || g.deltaY !== 0) {
|
|
6369
6440
|
const { left: v = 0, top: M = 0 } = e;
|
|
6370
6441
|
e.set({
|
|
6371
|
-
left: v +
|
|
6372
|
-
top: M +
|
|
6442
|
+
left: v + g.deltaX,
|
|
6443
|
+
top: M + g.deltaY
|
|
6373
6444
|
}), e.setCoords(), o = (m = pt({ object: e })) != null ? m : o;
|
|
6374
6445
|
}
|
|
6375
6446
|
this._applyGuides({
|
|
6376
6447
|
guides: u,
|
|
6377
|
-
spacingGuides:
|
|
6448
|
+
spacingGuides: g.guides
|
|
6378
6449
|
}), this._applyMovementStep({ target: e });
|
|
6379
6450
|
}
|
|
6380
6451
|
/**
|
|
@@ -6398,7 +6469,7 @@ class jn {
|
|
|
6398
6469
|
const { canvas: t, guideBounds: e } = this, s = t.getSelectionContext();
|
|
6399
6470
|
if (!s) return;
|
|
6400
6471
|
const n = e != null ? e : this._calculateViewportBounds(), { left: o, right: i, top: a, bottom: r } = n, { viewportTransform: c } = t, d = t.getZoom() || 1;
|
|
6401
|
-
s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth =
|
|
6472
|
+
s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = pe / d, s.strokeStyle = ss, s.setLineDash([4, 4]);
|
|
6402
6473
|
for (const l of this.activeGuides)
|
|
6403
6474
|
s.beginPath(), l.type === "vertical" ? (s.moveTo(l.position, a), s.lineTo(l.position, r)) : (s.moveTo(o, l.position), s.lineTo(i, l.position)), s.stroke();
|
|
6404
6475
|
for (const l of this.activeSpacingGuides)
|
|
@@ -6438,7 +6509,7 @@ class jn {
|
|
|
6438
6509
|
* Применяет шаг перемещения, округляя координаты объекта к сетке MOVE_SNAP_STEP.
|
|
6439
6510
|
*/
|
|
6440
6511
|
_applyMovementStep({ target: t }) {
|
|
6441
|
-
const { left: e = 0, top: s = 0 } = t, n = Math.round(e /
|
|
6512
|
+
const { left: e = 0, top: s = 0 } = t, n = Math.round(e / Jt) * Jt, o = Math.round(s / Jt) * Jt;
|
|
6442
6513
|
n === e && o === s || (t.set({
|
|
6443
6514
|
left: n,
|
|
6444
6515
|
top: o
|
|
@@ -6677,9 +6748,9 @@ class Lt {
|
|
|
6677
6748
|
left: d = 0,
|
|
6678
6749
|
right: l = 0,
|
|
6679
6750
|
top: u = 0,
|
|
6680
|
-
bottom:
|
|
6681
|
-
centerY:
|
|
6682
|
-
} = e, p = Math.max(a, u), m = Math.min(r,
|
|
6751
|
+
bottom: f = 0,
|
|
6752
|
+
centerY: g = 0
|
|
6753
|
+
} = e, p = Math.max(a, u), m = Math.min(r, f), M = m >= p ? (p + m) / 2 : (c + g) / 2;
|
|
6683
6754
|
if (d >= i) {
|
|
6684
6755
|
if (s) return n;
|
|
6685
6756
|
const T = d - i;
|
|
@@ -6738,9 +6809,9 @@ class Lt {
|
|
|
6738
6809
|
top: d = 0,
|
|
6739
6810
|
bottom: l = 0,
|
|
6740
6811
|
left: u = 0,
|
|
6741
|
-
right:
|
|
6742
|
-
centerX:
|
|
6743
|
-
} = e, p = Math.max(a, u), m = Math.min(r,
|
|
6812
|
+
right: f = 0,
|
|
6813
|
+
centerX: g = 0
|
|
6814
|
+
} = e, p = Math.max(a, u), m = Math.min(r, f), M = m >= p ? (p + m) / 2 : (c + g) / 2;
|
|
6744
6815
|
if (d >= i) {
|
|
6745
6816
|
if (s) return n;
|
|
6746
6817
|
const T = d - i;
|
|
@@ -6808,14 +6879,14 @@ class Lt {
|
|
|
6808
6879
|
const { viewportTransform: s } = t, n = t.getZoom() || 1, o = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = o && i && !this.isTargetMontageArea, r = a ? 12 / n : 0;
|
|
6809
6880
|
e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = $e / n, e.strokeStyle = Je, e.setLineDash([]);
|
|
6810
6881
|
for (const c of this.activeGuides) {
|
|
6811
|
-
const { type: d, axis: l, start: u, end:
|
|
6812
|
-
e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l,
|
|
6882
|
+
const { type: d, axis: l, start: u, end: f, distance: g } = c, p = Math.abs(f - u), m = u <= f ? -1 : 1, v = a ? m * (p / 2 + r) : 0, M = 0;
|
|
6883
|
+
e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, f)) : (e.moveTo(u, l), e.lineTo(f, l)), e.stroke(), me({
|
|
6813
6884
|
context: e,
|
|
6814
6885
|
type: d,
|
|
6815
6886
|
axis: l,
|
|
6816
6887
|
start: u,
|
|
6817
|
-
end:
|
|
6818
|
-
text: Math.round(
|
|
6888
|
+
end: f,
|
|
6889
|
+
text: Math.round(g).toString(),
|
|
6819
6890
|
zoom: n,
|
|
6820
6891
|
color: Je,
|
|
6821
6892
|
lineWidth: $e,
|
|
@@ -6844,7 +6915,7 @@ class Lt {
|
|
|
6844
6915
|
(e = t == null ? void 0 : t.showAfterTemporary) == null || e.call(t), this.isToolbarHidden = !1;
|
|
6845
6916
|
}
|
|
6846
6917
|
}
|
|
6847
|
-
class
|
|
6918
|
+
class Se {
|
|
6848
6919
|
/**
|
|
6849
6920
|
* Конструктор класса ImageEditor.
|
|
6850
6921
|
* @param canvasId - идентификатор канваса, в котором будет создан редактор
|
|
@@ -6874,13 +6945,13 @@ class Ae {
|
|
|
6874
6945
|
showRotationAngle: d,
|
|
6875
6946
|
_onReadyCallback: l
|
|
6876
6947
|
} = this.options;
|
|
6877
|
-
if ($.apply(), this.canvas = new ys(this.containerId, this.options), this.moduleLoader = new Ss(), this.workerManager = new js(), this.errorManager = new
|
|
6948
|
+
if ($.apply(), this.canvas = new ys(this.containerId, this.options), this.moduleLoader = new Ss(), this.workerManager = new js(), this.errorManager = new Wt({ editor: this }), this.historyManager = new Ys({ editor: this }), this.toolbar = new Ps({ editor: this }), this.transformManager = new qs({ editor: this }), this.zoomManager = new Js({ editor: this }), this.canvasManager = new Qs({ editor: this }), this.imageManager = new dt({ editor: this }), this.layerManager = new te({ editor: this }), this.shapeManager = new tn({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Ot({ editor: this }), this.clipboardManager = new en({ editor: this }), this.objectLockManager = new ee({ editor: this }), this.groupingManager = new sn({ editor: this }), this.selectionManager = new nn({ editor: this }), this.deletionManager = new we({ editor: this }), this.panConstraintManager = new on({ editor: this }), this.snappingManager = new jn({ editor: this }), this.measurementManager = new Lt({ editor: this }), this.fontManager = new ge((u = this.options.fonts) != null ? u : []), this.textManager = new P({ editor: this }), this.templateManager = new R({ editor: this }), d && (this.angleIndicator = new Me({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Ft({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
|
|
6878
6949
|
const {
|
|
6879
|
-
source:
|
|
6880
|
-
scale:
|
|
6950
|
+
source: f,
|
|
6951
|
+
scale: g = `image-${c}`,
|
|
6881
6952
|
withoutSave: p = !0
|
|
6882
6953
|
} = a;
|
|
6883
|
-
yield this.imageManager.importImage({ source:
|
|
6954
|
+
yield this.imageManager.importImage({ source: f, scale: g, withoutSave: p });
|
|
6884
6955
|
}
|
|
6885
6956
|
r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof l == "function" && l(this);
|
|
6886
6957
|
});
|
|
@@ -6896,7 +6967,7 @@ class Ae {
|
|
|
6896
6967
|
this.montageArea = this.shapeManager.addRectangle({
|
|
6897
6968
|
width: t,
|
|
6898
6969
|
height: e,
|
|
6899
|
-
fill:
|
|
6970
|
+
fill: Se._createMosaicPattern(),
|
|
6900
6971
|
stroke: null,
|
|
6901
6972
|
strokeWidth: 0,
|
|
6902
6973
|
selectable: !1,
|
|
@@ -7883,7 +7954,7 @@ function Dn(h, t = {}) {
|
|
|
7883
7954
|
const n = document.createElement("canvas");
|
|
7884
7955
|
return n.id = `${h}-canvas`, s.appendChild(n), e.editorContainer = s, new Promise((o) => {
|
|
7885
7956
|
e._onReadyCallback = o;
|
|
7886
|
-
const i = new
|
|
7957
|
+
const i = new Se(n.id, e);
|
|
7887
7958
|
window[h] = i;
|
|
7888
7959
|
});
|
|
7889
7960
|
}
|