@printine/pod-editor 0.1.18 → 0.1.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/{design-CWY-22HD.js → design-Ce0Lyr8f.js} +598 -592
- package/dist/engine/editor.js +120 -116
- package/dist/full-designer.js +2 -2
- package/dist/index.js +4 -4
- package/dist/pixel-map-CSpWvUYE.js +315 -0
- package/dist/{pixi-print-base-CKs4lF7h.js → pixi-print-base-DIvtSF7v.js} +1 -1
- package/dist/renderer/pixel-map.d.ts +9 -2
- package/dist/{semi-interact-editor-nZVBXXQn.js → semi-interact-editor-DpzQN5ZB.js} +2 -2
- package/dist/semi-renderer.js +1 -1
- package/dist/style.css +1 -1
- package/docs/HOST_DATA_CONTRACT.md +1 -1
- package/docs/SEMI_RENDERER.md +37 -1
- package/package.json +1 -1
- package/dist/pixel-map-BvQ0VU_i.js +0 -199
package/dist/engine/editor.js
CHANGED
|
@@ -4,14 +4,14 @@ import { cloneObject as b, urlToDataURL as E } from "./utils/common.js";
|
|
|
4
4
|
import { loadOverlaySvgImage as T, loadImage as B } from "./utils/image.js";
|
|
5
5
|
import { Loading as Y } from "./utils/loading.js";
|
|
6
6
|
import { HistoryManager as X } from "./history.js";
|
|
7
|
-
import { LAYER_BLACK_LIST as
|
|
7
|
+
import { LAYER_BLACK_LIST as I } from "./constants.js";
|
|
8
8
|
import U from "./events.js";
|
|
9
9
|
import { ImageProcessor as L } from "./processors/image.js";
|
|
10
10
|
import { TemplateProcessor as W } from "./processors/template.js";
|
|
11
11
|
import { TextProcessor as D } from "./processors/text.js";
|
|
12
12
|
import { ResizeManager as _ } from "./managers/resize.js";
|
|
13
13
|
import { WorkspaceManager as q } from "./managers/workspace.js";
|
|
14
|
-
import { fabric as
|
|
14
|
+
import { fabric as f } from "fabric";
|
|
15
15
|
class se {
|
|
16
16
|
constructor(t, a, e, r = {}) {
|
|
17
17
|
this.previewExporting = !1, this.imageCache = /* @__PURE__ */ new Map(), this.overlayCache = /* @__PURE__ */ new Map(), this.destroyed = !1, this.deleteObject = (n) => {
|
|
@@ -27,7 +27,7 @@ class se {
|
|
|
27
27
|
this.canvas.requestRenderAll();
|
|
28
28
|
};
|
|
29
29
|
const s = typeof r == "number" ? { overlayScale: r } : r;
|
|
30
|
-
this.canvas = new
|
|
30
|
+
this.canvas = new f.Canvas(t, {
|
|
31
31
|
enableRetinaScaling: !0,
|
|
32
32
|
width: a.width,
|
|
33
33
|
height: a.height,
|
|
@@ -60,44 +60,44 @@ class se {
|
|
|
60
60
|
* 统一拦截图片创建:优先从会话缓存复用已加载的 HTMLImageElement,避免视图切换或导出时重复请求远程图片
|
|
61
61
|
*/
|
|
62
62
|
setupImageCacheInterceptor() {
|
|
63
|
-
const t = this.imageCache, a =
|
|
64
|
-
if (
|
|
65
|
-
|
|
63
|
+
const t = this.imageCache, a = f.Image.fromURL, e = f.Image.fromObject;
|
|
64
|
+
if (f.Image._printineCacheHooked) return;
|
|
65
|
+
f.Image._printineCacheHooked = !0;
|
|
66
66
|
const r = (n) => {
|
|
67
67
|
if (!n) return null;
|
|
68
68
|
const i = t.get(n);
|
|
69
69
|
return i?.element && i.element.complete ? (t.set(n, { ...i, lastUsed: Date.now() }), i.element) : null;
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
f.Image.fromURL = function(n, i, c) {
|
|
72
72
|
const o = { ...c, crossOrigin: "anonymous" }, l = r(n);
|
|
73
73
|
if (l) {
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const m = new f.Image(l, o);
|
|
75
|
+
m.originSrc = n, i && i(m);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
return a.call(
|
|
79
79
|
this,
|
|
80
80
|
n,
|
|
81
|
-
(
|
|
82
|
-
|
|
81
|
+
(m) => {
|
|
82
|
+
m && (m.originSrc = n), i && i(m);
|
|
83
83
|
},
|
|
84
84
|
o
|
|
85
85
|
);
|
|
86
86
|
};
|
|
87
87
|
const s = (n) => !!n && typeof n == "object" && typeof n.set == "function" && typeof n.shouldCache == "function";
|
|
88
|
-
|
|
88
|
+
f.Image.fromObject = function(n, i) {
|
|
89
89
|
const c = n?.originSrc || n?.src, o = r(c);
|
|
90
90
|
if (o) {
|
|
91
|
-
const { clipPath: l, ...
|
|
92
|
-
if (
|
|
93
|
-
l && (
|
|
91
|
+
const { clipPath: l, ...m } = n ?? {}, u = new f.Image(o, { ...m });
|
|
92
|
+
if (u.originSrc = c, !l || s(l)) {
|
|
93
|
+
l && (u.clipPath = l), i?.(u);
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
f.util.enlivenObjects(
|
|
97
97
|
[l],
|
|
98
|
-
(
|
|
99
|
-
const [
|
|
100
|
-
|
|
98
|
+
(w) => {
|
|
99
|
+
const [O] = w || [];
|
|
100
|
+
O && (u.clipPath = O), i?.(u);
|
|
101
101
|
},
|
|
102
102
|
""
|
|
103
103
|
);
|
|
@@ -182,26 +182,26 @@ class se {
|
|
|
182
182
|
strokeUniform: !0,
|
|
183
183
|
objectCaching: !1
|
|
184
184
|
}), e.render(r);
|
|
185
|
-
const i = 6, c = (e.getScaledWidth() + i * 2) / e.getScaledWidth(), o = (e.getScaledHeight() + i * 2) / e.getScaledHeight(), l = e.left ?? 0,
|
|
185
|
+
const i = 6, c = (e.getScaledWidth() + i * 2) / e.getScaledWidth(), o = (e.getScaledHeight() + i * 2) / e.getScaledHeight(), l = e.left ?? 0, m = e.top ?? 0, u = e.scaleX ?? 1, w = e.scaleY ?? 1;
|
|
186
186
|
e.set({
|
|
187
187
|
strokeDashArray: [4, 4],
|
|
188
188
|
stroke: "#C3C3CC",
|
|
189
189
|
strokeWidth: 1,
|
|
190
190
|
strokeUniform: !0,
|
|
191
|
-
scaleX:
|
|
192
|
-
scaleY:
|
|
191
|
+
scaleX: u * c,
|
|
192
|
+
scaleY: w * o,
|
|
193
193
|
left: l - i,
|
|
194
|
-
top:
|
|
194
|
+
top: m - i
|
|
195
195
|
}), e.render(r), e.set({
|
|
196
196
|
stroke: n.stroke,
|
|
197
197
|
strokeWidth: n.strokeWidth,
|
|
198
198
|
strokeDashArray: n.strokeDashArray,
|
|
199
199
|
fill: n.fill,
|
|
200
200
|
strokeUniform: n.strokeUniform,
|
|
201
|
-
scaleX:
|
|
202
|
-
scaleY:
|
|
201
|
+
scaleX: u,
|
|
202
|
+
scaleY: w,
|
|
203
203
|
left: l,
|
|
204
|
-
top:
|
|
204
|
+
top: m
|
|
205
205
|
}), r.restore();
|
|
206
206
|
}, this.canvas.on("after:render", this.overlayBorderHandler);
|
|
207
207
|
}
|
|
@@ -260,7 +260,7 @@ class se {
|
|
|
260
260
|
*/
|
|
261
261
|
async restoreObject(t) {
|
|
262
262
|
return new Promise((a) => {
|
|
263
|
-
|
|
263
|
+
f.util.enlivenObjects([t], (e) => a(e), "");
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
@@ -357,7 +357,7 @@ class se {
|
|
|
357
357
|
* 获取当前可选择的对象,不包括背景图、裁剪区域
|
|
358
358
|
*/
|
|
359
359
|
getLayerList() {
|
|
360
|
-
return this.canvas._objects.filter((t) => !
|
|
360
|
+
return this.canvas._objects.filter((t) => !I.includes(t.id || ""));
|
|
361
361
|
}
|
|
362
362
|
/**
|
|
363
363
|
* 设置当前选中的对象
|
|
@@ -370,7 +370,7 @@ class se {
|
|
|
370
370
|
* 同时选中多个对象
|
|
371
371
|
*/
|
|
372
372
|
setActiveObjects(t) {
|
|
373
|
-
const a = new
|
|
373
|
+
const a = new f.ActiveSelection(t, { canvas: this.canvas });
|
|
374
374
|
this.canvas.setActiveObject(a), this.canvas.requestRenderAll();
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
@@ -391,7 +391,7 @@ class se {
|
|
|
391
391
|
getRenderedObjects() {
|
|
392
392
|
const { objects: t } = this.canvas.toJSON(X.DEFAULT_SAVE_PROPERTIES), a = this.workspaceManager.dimension;
|
|
393
393
|
return {
|
|
394
|
-
objects: t.filter((e) => !
|
|
394
|
+
objects: t.filter((e) => !I.includes(e.id || "")),
|
|
395
395
|
workspaceMetadata: {
|
|
396
396
|
width: a.width,
|
|
397
397
|
height: a.height,
|
|
@@ -431,7 +431,7 @@ class se {
|
|
|
431
431
|
async switchView(t, a, e) {
|
|
432
432
|
if (this.isCanvasReady()) {
|
|
433
433
|
if (this.canvas.clear(), e && e.objects && e.objects.length)
|
|
434
|
-
return
|
|
434
|
+
return f.AdvancedIText = A, await this.textProcessor.preloadFontsFromState(e), this.isCanvasReady() ? new Promise((r) => {
|
|
435
435
|
this.canvas.loadFromJSON(
|
|
436
436
|
e,
|
|
437
437
|
async () => {
|
|
@@ -465,7 +465,7 @@ class se {
|
|
|
465
465
|
this.canvas.renderAll(), this.events.emit("design:layerChange"), r();
|
|
466
466
|
},
|
|
467
467
|
(s, n) => {
|
|
468
|
-
s.clipPath && !e.objects.some((i) => i.id === s.clipPath.id) && (delete n.clipPath,
|
|
468
|
+
s.clipPath && !e.objects.some((i) => i.id === s.clipPath.id) && (delete n.clipPath, f.util.enlivenObjects(
|
|
469
469
|
[s.clipPath],
|
|
470
470
|
(i) => {
|
|
471
471
|
const c = i[0];
|
|
@@ -486,30 +486,30 @@ class se {
|
|
|
486
486
|
const a = this.workspaceManager.dimension, e = Math.min(
|
|
487
487
|
a.width / t.width,
|
|
488
488
|
a.height / t.height
|
|
489
|
-
), r = t.centerX, s = t.centerY, n = a.center.x, i = a.center.y, c = Math.abs(n - r), o = Math.abs(i - s), l = Math.abs(e - 1) >= 1e-3,
|
|
490
|
-
if (!l && !
|
|
491
|
-
const
|
|
492
|
-
const
|
|
493
|
-
|
|
489
|
+
), r = t.centerX, s = t.centerY, n = a.center.x, i = a.center.y, c = Math.abs(n - r), o = Math.abs(i - s), l = Math.abs(e - 1) >= 1e-3, m = c >= 0.1 || o >= 0.1;
|
|
490
|
+
if (!l && !m) return;
|
|
491
|
+
const u = this.canvas.getObjects(), w = new Set(u), O = /* @__PURE__ */ new Set(), k = (d) => {
|
|
492
|
+
const p = d.clipPath;
|
|
493
|
+
p && w.has(p) && O.add(p);
|
|
494
494
|
};
|
|
495
|
-
|
|
496
|
-
const
|
|
497
|
-
const
|
|
495
|
+
u.forEach(k);
|
|
496
|
+
const g = (d) => {
|
|
497
|
+
const p = (d.left || 0) - r, P = (d.top || 0) - s, y = n + p * e, v = i + P * e;
|
|
498
498
|
d.set({
|
|
499
|
-
left:
|
|
500
|
-
top:
|
|
499
|
+
left: y,
|
|
500
|
+
top: v,
|
|
501
501
|
scaleX: (d.scaleX || 1) * e,
|
|
502
502
|
scaleY: (d.scaleY || 1) * e
|
|
503
503
|
}), d.setCoords(), d.dirty = !0;
|
|
504
|
-
},
|
|
505
|
-
!d.selectable && !
|
|
504
|
+
}, C = /* @__PURE__ */ new Set(), S = (d) => {
|
|
505
|
+
!d.selectable && !O.has(d) || (g(d), C.add(d));
|
|
506
506
|
};
|
|
507
|
-
|
|
507
|
+
u.forEach(S);
|
|
508
508
|
const h = (d) => {
|
|
509
|
-
const
|
|
510
|
-
|
|
509
|
+
const p = d.clipPath;
|
|
510
|
+
p && p.absolutePositioned && !w.has(p) && !C.has(p) && (g(p), C.add(p));
|
|
511
511
|
};
|
|
512
|
-
|
|
512
|
+
u.forEach(h);
|
|
513
513
|
}
|
|
514
514
|
/**
|
|
515
515
|
* 计算对象相对于画布的全局变换矩阵(包括父组的影响)
|
|
@@ -594,7 +594,7 @@ class se {
|
|
|
594
594
|
});
|
|
595
595
|
const i = this.imageCache.get(n);
|
|
596
596
|
return i?.element && i.element.complete ? new Promise(async (c) => {
|
|
597
|
-
const o = new
|
|
597
|
+
const o = new f.Image(i.element, {
|
|
598
598
|
width: t.width,
|
|
599
599
|
height: t.height,
|
|
600
600
|
...a
|
|
@@ -619,7 +619,7 @@ class se {
|
|
|
619
619
|
*/
|
|
620
620
|
async export(t = !1, a) {
|
|
621
621
|
const e = this.workspaceManager.dimension, r = this.workspaceManager.printAreaSize?.width ?? e.width, s = this.workspaceManager.printAreaSize?.height ?? e.height, n = window.devicePixelRatio || 1, i = Math.max(r / e.width, s / e.height), c = Math.max(4, Math.min(8, Math.ceil(i * n)));
|
|
622
|
-
let o = new
|
|
622
|
+
let o = new f.Rect({
|
|
623
623
|
left: 0,
|
|
624
624
|
top: 0,
|
|
625
625
|
width: e.width,
|
|
@@ -632,41 +632,41 @@ class se {
|
|
|
632
632
|
top: this.canvas.clipPath.top - e.top,
|
|
633
633
|
absolutePositioned: !0
|
|
634
634
|
}));
|
|
635
|
-
const l = new
|
|
635
|
+
const l = new f.StaticCanvas(null, {
|
|
636
636
|
width: e.width,
|
|
637
637
|
height: e.height,
|
|
638
638
|
enableRetinaScaling: !1,
|
|
639
639
|
backgroundColor: a || "transparent",
|
|
640
640
|
preserveObjectStacking: !0,
|
|
641
641
|
clipPath: o
|
|
642
|
-
}),
|
|
642
|
+
}), m = this.getLayerList();
|
|
643
643
|
(await Promise.all(
|
|
644
|
-
|
|
644
|
+
m.map(
|
|
645
645
|
(h) => new Promise((d) => {
|
|
646
646
|
try {
|
|
647
647
|
if (h.type === "image") {
|
|
648
|
-
const
|
|
649
|
-
let
|
|
648
|
+
const p = h;
|
|
649
|
+
let P = {
|
|
650
650
|
selectable: !1,
|
|
651
651
|
evented: !1,
|
|
652
652
|
flipX: h.flipX || !1,
|
|
653
653
|
flipY: h.flipY || !1
|
|
654
654
|
};
|
|
655
655
|
if (this.isInActiveSelection(h)) {
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
...
|
|
659
|
-
left: (
|
|
660
|
-
top: (
|
|
661
|
-
angle:
|
|
662
|
-
scaleX:
|
|
663
|
-
scaleY:
|
|
656
|
+
const y = this.getGlobalTransformMatrix(h), v = f.util.qrDecompose(y);
|
|
657
|
+
P = {
|
|
658
|
+
...P,
|
|
659
|
+
left: (v.translateX || 0) - (e.left || 0),
|
|
660
|
+
top: (v.translateY || 0) - (e.top || 0),
|
|
661
|
+
angle: v.angle || 0,
|
|
662
|
+
scaleX: v.scaleX || 1,
|
|
663
|
+
scaleY: v.scaleY || 1,
|
|
664
664
|
originX: "center",
|
|
665
665
|
originY: "center"
|
|
666
666
|
};
|
|
667
667
|
} else
|
|
668
|
-
|
|
669
|
-
...
|
|
668
|
+
P = {
|
|
669
|
+
...P,
|
|
670
670
|
left: h.left - e.left,
|
|
671
671
|
top: h.top - e.top,
|
|
672
672
|
angle: h.angle || 0,
|
|
@@ -675,39 +675,39 @@ class se {
|
|
|
675
675
|
originX: "left",
|
|
676
676
|
originY: "top"
|
|
677
677
|
};
|
|
678
|
-
this.cloneImageFromCache(
|
|
679
|
-
if (
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
left: (
|
|
683
|
-
top: (
|
|
678
|
+
this.cloneImageFromCache(p, P).then(async (y) => {
|
|
679
|
+
if (y.clipPath) {
|
|
680
|
+
const v = y.clipPath;
|
|
681
|
+
v.absolutePositioned && v.set({
|
|
682
|
+
left: (v.left || 0) - e.left,
|
|
683
|
+
top: (v.top || 0) - e.top
|
|
684
684
|
});
|
|
685
685
|
}
|
|
686
|
-
if (t &&
|
|
686
|
+
if (t && y.type === "image")
|
|
687
687
|
try {
|
|
688
|
-
const
|
|
689
|
-
if (
|
|
690
|
-
const x = await this.getCachedDataURL(
|
|
691
|
-
|
|
688
|
+
const v = y, R = v.getSrc() || v.originSrc || "";
|
|
689
|
+
if (R) {
|
|
690
|
+
const x = await this.getCachedDataURL(R);
|
|
691
|
+
v.setSrc(x, () => d(y));
|
|
692
692
|
return;
|
|
693
693
|
}
|
|
694
694
|
} catch {
|
|
695
695
|
}
|
|
696
|
-
d(
|
|
696
|
+
d(y);
|
|
697
697
|
}).catch(() => {
|
|
698
698
|
d(h);
|
|
699
699
|
});
|
|
700
700
|
} else
|
|
701
701
|
h.cloneAsImage(
|
|
702
|
-
(
|
|
702
|
+
(p) => {
|
|
703
703
|
if (this.isInActiveSelection(h)) {
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
left: (
|
|
707
|
-
top: (
|
|
708
|
-
angle:
|
|
709
|
-
scaleX: (
|
|
710
|
-
scaleY: (
|
|
704
|
+
const P = this.getGlobalTransformMatrix(h), y = f.util.qrDecompose(P);
|
|
705
|
+
p.set({
|
|
706
|
+
left: (y.translateX || 0) - (e.left || 0),
|
|
707
|
+
top: (y.translateY || 0) - (e.top || 0),
|
|
708
|
+
angle: y.angle || 0,
|
|
709
|
+
scaleX: (y.scaleX || 1) / c,
|
|
710
|
+
scaleY: (y.scaleY || 1) / c,
|
|
711
711
|
selectable: !1,
|
|
712
712
|
hasControls: !1,
|
|
713
713
|
hasBorders: !1,
|
|
@@ -715,10 +715,10 @@ class se {
|
|
|
715
715
|
originY: "center"
|
|
716
716
|
});
|
|
717
717
|
} else {
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
left:
|
|
721
|
-
top:
|
|
718
|
+
const P = h.getBoundingRect(!0, !0);
|
|
719
|
+
p.set({
|
|
720
|
+
left: P.left - e.left,
|
|
721
|
+
top: P.top - e.top,
|
|
722
722
|
scaleX: 1 / c,
|
|
723
723
|
scaleY: 1 / c,
|
|
724
724
|
angle: 0,
|
|
@@ -729,7 +729,7 @@ class se {
|
|
|
729
729
|
originY: "top"
|
|
730
730
|
});
|
|
731
731
|
}
|
|
732
|
-
d(
|
|
732
|
+
d(p);
|
|
733
733
|
},
|
|
734
734
|
{ multiplier: c }
|
|
735
735
|
);
|
|
@@ -739,25 +739,25 @@ class se {
|
|
|
739
739
|
})
|
|
740
740
|
)
|
|
741
741
|
)).forEach((h) => l.add(h));
|
|
742
|
-
const
|
|
743
|
-
l.setViewportTransform([
|
|
744
|
-
const
|
|
745
|
-
let
|
|
746
|
-
(r <
|
|
747
|
-
let
|
|
742
|
+
const w = r / e.width, O = s / e.height;
|
|
743
|
+
l.setViewportTransform([w, 0, 0, O, 0, 0]), l.renderAll();
|
|
744
|
+
const k = 1024;
|
|
745
|
+
let g = 1;
|
|
746
|
+
(r < k || s < k) && (g = Math.max(1, k / Math.max(r, s)));
|
|
747
|
+
let C = "";
|
|
748
748
|
const S = () => l.toDataURL({
|
|
749
749
|
format: "webp",
|
|
750
750
|
quality: 0.5,
|
|
751
751
|
width: r,
|
|
752
752
|
height: s,
|
|
753
|
-
multiplier:
|
|
753
|
+
multiplier: g
|
|
754
754
|
});
|
|
755
755
|
if (window.createImageBitmap && typeof l.toCanvasElement == "function") {
|
|
756
|
-
const h = l.toCanvasElement(
|
|
757
|
-
|
|
756
|
+
const h = l.toCanvasElement(g, { width: r, height: s });
|
|
757
|
+
C = await createImageBitmap(h);
|
|
758
758
|
} else
|
|
759
|
-
|
|
760
|
-
return l.dispose(),
|
|
759
|
+
C = S();
|
|
760
|
+
return l.dispose(), C;
|
|
761
761
|
}
|
|
762
762
|
/**
|
|
763
763
|
* Rasterize the current design for real-time product previews without
|
|
@@ -771,27 +771,31 @@ class se {
|
|
|
771
771
|
const e = this.workspaceManager.dimension, r = this.workspaceManager.printAreaSize?.width ?? e.width, s = this.workspaceManager.printAreaSize?.height ?? e.height;
|
|
772
772
|
if (!e.width || !e.height || !r || !s)
|
|
773
773
|
throw new Error("Printable workspace has no dimensions");
|
|
774
|
-
const n = Math.max(r, s), i = t / n, c = Math.max(1, Math.round(r * i)), o = Math.max(1, Math.round(s * i)), l = this.canvas.viewportTransform?.slice(),
|
|
774
|
+
const n = Math.max(r, s), i = t / n, c = Math.max(1, Math.round(r * i)), o = Math.max(1, Math.round(s * i)), l = this.canvas.viewportTransform?.slice(), m = this.canvas.overlayImage?.visible, u = this.canvas.backgroundColor, w = this.canvas.getActiveObject(), O = w ? { hasBorders: w.hasBorders, hasControls: w.hasControls } : null, k = this.canvas.getObjects().filter((g) => g.id === "loading" || g.id === "cropRect" || g.id === "cropOverlay").map((g) => ({ object: g, visible: g.visible }));
|
|
775
775
|
try {
|
|
776
|
-
this.previewExporting = !0, this.canvas.overlayImage && (this.canvas.overlayImage.visible = !1),
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
e.
|
|
787
|
-
e.
|
|
776
|
+
this.previewExporting = !0, this.canvas.overlayImage && (this.canvas.overlayImage.visible = !1), w?.set({ hasBorders: !1, hasControls: !1 }), k.forEach(({ object: d }) => {
|
|
777
|
+
d.visible = !1;
|
|
778
|
+
}), this.canvas.backgroundColor = a || "transparent", this.canvas.viewportTransform = [1, 0, 0, 1, 0, 0], this.canvas.renderAll();
|
|
779
|
+
const g = document.createElement("canvas");
|
|
780
|
+
g.width = c, g.height = o;
|
|
781
|
+
const C = g.getContext("2d", { alpha: !0 });
|
|
782
|
+
if (!C) throw new Error("Could not create preview canvas context");
|
|
783
|
+
const S = this.canvas, h = S.getRetinaScaling?.() ?? window.devicePixelRatio ?? 1;
|
|
784
|
+
return C.drawImage(
|
|
785
|
+
S.lowerCanvasEl,
|
|
786
|
+
e.left * h,
|
|
787
|
+
e.top * h,
|
|
788
|
+
e.width * h,
|
|
789
|
+
e.height * h,
|
|
788
790
|
0,
|
|
789
791
|
0,
|
|
790
792
|
c,
|
|
791
793
|
o
|
|
792
|
-
), await createImageBitmap(
|
|
794
|
+
), await createImageBitmap(g);
|
|
793
795
|
} finally {
|
|
794
|
-
this.canvas.backgroundColor =
|
|
796
|
+
this.canvas.backgroundColor = u, this.canvas.overlayImage && m !== void 0 && (this.canvas.overlayImage.visible = m), w && O && w.set(O), k.forEach(({ object: g, visible: C }) => {
|
|
797
|
+
g.visible = C;
|
|
798
|
+
}), l && (this.canvas.viewportTransform = l), this.previewExporting = !1, this.isCanvasReady() && this.canvas.requestRenderAll();
|
|
795
799
|
}
|
|
796
800
|
}
|
|
797
801
|
}
|
package/dist/full-designer.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { c as s } from "./design-
|
|
3
|
+
import { c as s } from "./design-Ce0Lyr8f.js";
|
|
4
4
|
import "./engine/events.js";
|
|
5
5
|
import "zustand/react/shallow";
|
|
6
6
|
import "./engine/history.js";
|
|
7
7
|
import "lodash-es/throttle";
|
|
8
8
|
import "./engine/constants.js";
|
|
9
9
|
import "./engine/utils/common.js";
|
|
10
|
-
import "./pixel-map-
|
|
10
|
+
import "./pixel-map-CSpWvUYE.js";
|
|
11
11
|
import "./designer-store-Da9fICz8.js";
|
|
12
12
|
export {
|
|
13
13
|
s as default
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AdvancedIText as G } from "./engine/fabric.js";
|
|
2
|
-
import { a as S, s as f, D as L, b as _, c as C, C as F } from "./design-
|
|
3
|
-
import { F as K, S as V, u as X } from "./design-
|
|
2
|
+
import { a as S, s as f, D as L, b as _, c as C, C as F } from "./design-Ce0Lyr8f.js";
|
|
3
|
+
import { F as K, S as V, u as X } from "./design-Ce0Lyr8f.js";
|
|
4
4
|
import { jsx as r, jsxs as R } from "react/jsx-runtime";
|
|
5
5
|
import { useMemo as b, useEffect as a } from "react";
|
|
6
6
|
import { DEFAULT_PRINTINE_ASSET_BASE_URL as U, createAssetCenterApiClient as B } from "./api/asset-client.js";
|
|
7
7
|
import { s as d } from "./designer-store-Da9fICz8.js";
|
|
8
8
|
import { A as $, u as q } from "./designer-store-Da9fICz8.js";
|
|
9
9
|
import { d as y, s as M } from "./config-D2qm60gf.js";
|
|
10
|
-
import { P as Q, a as ee } from "./semi-interact-editor-
|
|
11
|
-
import { P as te } from "./pixel-map-
|
|
10
|
+
import { P as Q, a as ee } from "./semi-interact-editor-DpzQN5ZB.js";
|
|
11
|
+
import { P as te } from "./pixel-map-CSpWvUYE.js";
|
|
12
12
|
import { CanvasDesigner as ae, renderPlacementPreviews as ne } from "./engine/canvas-designer.js";
|
|
13
13
|
import { Editor as ie } from "./engine/editor.js";
|
|
14
14
|
import { HistoryManager as me } from "./engine/history.js";
|