@pixldocs/canvas-renderer 0.5.284 → 0.5.286
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/{index-n9HBI3ow.cjs → index-4L9uZ78v.cjs} +128 -306
- package/dist/index-4L9uZ78v.cjs.map +1 -0
- package/dist/{index-BAQJjsT4.js → index-EkY5XEkR.js} +128 -306
- package/dist/index-EkY5XEkR.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-C28yMJ_a.cjs → vectorPdfExport-DqdRBbl_.cjs} +4 -4
- package/dist/{vectorPdfExport-C28yMJ_a.cjs.map → vectorPdfExport-DqdRBbl_.cjs.map} +1 -1
- package/dist/{vectorPdfExport-LTu10COA.js → vectorPdfExport-wObaRY6z.js} +4 -4
- package/dist/{vectorPdfExport-LTu10COA.js.map → vectorPdfExport-wObaRY6z.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BAQJjsT4.js.map +0 -1
- package/dist/index-n9HBI3ow.cjs.map +0 -1
|
@@ -10476,10 +10476,6 @@ const SELECTION_PRIMARY = "hsl(217, 91%, 60%)";
|
|
|
10476
10476
|
const SELECTION_BORDER_SCALE = 2;
|
|
10477
10477
|
let ensureCanvaControlRenders = () => {
|
|
10478
10478
|
};
|
|
10479
|
-
const shouldLogGroupMove = () => {
|
|
10480
|
-
if (typeof window === "undefined") return false;
|
|
10481
|
-
return window.__pixldocsDebugGroupMove === true;
|
|
10482
|
-
};
|
|
10483
10479
|
try {
|
|
10484
10480
|
const InteractiveBase = fabric.InteractiveFabricObject ?? fabric.Object;
|
|
10485
10481
|
if ((InteractiveBase == null ? void 0 : InteractiveBase.prototype) && !InteractiveBase.prototype.__pixldocsCenteredSelectionBorder) {
|
|
@@ -10929,31 +10925,20 @@ try {
|
|
|
10929
10925
|
} catch (e) {
|
|
10930
10926
|
}
|
|
10931
10927
|
};
|
|
10932
|
-
const
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
target[key] = () => installPillRenders(original());
|
|
10939
|
-
} catch {
|
|
10940
|
-
}
|
|
10941
|
-
};
|
|
10942
|
-
tryPatchFactory(cu, "createObjectDefaultControls");
|
|
10943
|
-
tryPatchFactory(cu, "createTextboxDefaultControls");
|
|
10928
|
+
const origObj = cu.createObjectDefaultControls.bind(cu);
|
|
10929
|
+
cu.createObjectDefaultControls = () => installPillRenders(origObj());
|
|
10930
|
+
if (typeof cu.createTextboxDefaultControls === "function") {
|
|
10931
|
+
const origTb = cu.createTextboxDefaultControls.bind(cu);
|
|
10932
|
+
cu.createTextboxDefaultControls = () => installPillRenders(origTb());
|
|
10933
|
+
}
|
|
10944
10934
|
const wrapClassCreateControls = (Klass) => {
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
if (res && res.controls) installPillRenders(res.controls);
|
|
10953
|
-
return res;
|
|
10954
|
-
};
|
|
10955
|
-
} catch {
|
|
10956
|
-
}
|
|
10935
|
+
if (!Klass || typeof Klass.createControls !== "function") return;
|
|
10936
|
+
const orig = Klass.createControls.bind(Klass);
|
|
10937
|
+
Klass.createControls = () => {
|
|
10938
|
+
const res = orig();
|
|
10939
|
+
if (res && res.controls) installPillRenders(res.controls);
|
|
10940
|
+
return res;
|
|
10941
|
+
};
|
|
10957
10942
|
};
|
|
10958
10943
|
wrapClassCreateControls(fabric.InteractiveFabricObject);
|
|
10959
10944
|
wrapClassCreateControls(fabric.FabricObject);
|
|
@@ -10976,7 +10961,8 @@ try {
|
|
|
10976
10961
|
};
|
|
10977
10962
|
}
|
|
10978
10963
|
}
|
|
10979
|
-
} catch {
|
|
10964
|
+
} catch (e) {
|
|
10965
|
+
console.warn("[PageCanvas] Failed to install Canva-style control handles:", e);
|
|
10980
10966
|
}
|
|
10981
10967
|
const scaleTextPathConfig = (textPath, sx, sy, uniform) => {
|
|
10982
10968
|
if (!textPath || typeof textPath !== "object") return textPath;
|
|
@@ -11009,9 +10995,9 @@ const scaleUpdateNumber = (updates, source, key, factor) => {
|
|
|
11009
10995
|
const value = Number(source == null ? void 0 : source[key]);
|
|
11010
10996
|
if (Number.isFinite(value)) updates[key] = value * factor;
|
|
11011
10997
|
};
|
|
11012
|
-
const bakeTextboxScaleIntoTypography = (obj, sourceElement
|
|
11013
|
-
const sx = Math.abs(
|
|
11014
|
-
const sy = Math.abs(
|
|
10998
|
+
const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
10999
|
+
const sx = Math.abs(obj.scaleX ?? 1) || 1;
|
|
11000
|
+
const sy = Math.abs(obj.scaleY ?? 1) || 1;
|
|
11015
11001
|
if (Math.abs(sx - 1) < 1e-3 && Math.abs(sy - 1) < 1e-3) return null;
|
|
11016
11002
|
const isUniform = Math.abs(sx - sy) < 0.01;
|
|
11017
11003
|
const fontScale = isUniform ? (sx + sy) / 2 : Math.abs(sy - 1) > 1e-3 ? sy : 1;
|
|
@@ -11207,6 +11193,7 @@ const PageCanvas = forwardRef(
|
|
|
11207
11193
|
const skipActiveSelectionBakeOnClearRef = useRef(false);
|
|
11208
11194
|
const preserveEditingScopeOnSelectionClearRef = useRef(false);
|
|
11209
11195
|
const preserveActiveSelectionAfterTransformRef = useRef(null);
|
|
11196
|
+
const recentGroupSelectionRestoreRef = useRef(null);
|
|
11210
11197
|
const pendingGroupPromotionRef = useRef(null);
|
|
11211
11198
|
const pendingGroupDrillInRef = useRef(null);
|
|
11212
11199
|
const imageReloadRequestSeqRef = useRef(/* @__PURE__ */ new Map());
|
|
@@ -11227,7 +11214,6 @@ const PageCanvas = forwardRef(
|
|
|
11227
11214
|
useRef(null);
|
|
11228
11215
|
const lastTextEditDimensionsRef = useRef(null);
|
|
11229
11216
|
const lastResizeScaleTargetRef = useRef(null);
|
|
11230
|
-
const lastResizeScaleCornerRef = useRef(null);
|
|
11231
11217
|
const preserveSelectionAfterTransformIdRef = useRef(null);
|
|
11232
11218
|
const groupSelectionTransformStartRef = useRef(null);
|
|
11233
11219
|
const activeSelectionMoveStartRef = useRef(null);
|
|
@@ -11244,6 +11230,26 @@ const PageCanvas = forwardRef(
|
|
|
11244
11230
|
hoveredGroupId
|
|
11245
11231
|
} = useEditorStore();
|
|
11246
11232
|
const storeSelectedIds = canvas.selectedIds ?? [];
|
|
11233
|
+
const restoreGroupSelectionSnapshot = useCallback((snapshot) => {
|
|
11234
|
+
const fc = fabricRef.current;
|
|
11235
|
+
const groupId = snapshot == null ? void 0 : snapshot.groupSelectionId;
|
|
11236
|
+
if (!fc || !groupId || snapshot.memberIds.length < 2 || editingTextIdRef.current) return;
|
|
11237
|
+
const members = snapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
|
|
11238
|
+
if (members.length < 2) return;
|
|
11239
|
+
isSyncingSelectionToFabricRef.current = true;
|
|
11240
|
+
try {
|
|
11241
|
+
const active = fc.getActiveObject();
|
|
11242
|
+
const selection = active instanceof fabric.ActiveSelection && members.every((member) => active.getObjects().includes(member)) ? active : new fabric.ActiveSelection(members, { canvas: fc });
|
|
11243
|
+
applyLogicalGroupSelectionVisualState(selection, groupId);
|
|
11244
|
+
fc.setActiveObject(selection);
|
|
11245
|
+
selection.setCoords();
|
|
11246
|
+
fc.requestRenderAll();
|
|
11247
|
+
} finally {
|
|
11248
|
+
requestAnimationFrame(() => {
|
|
11249
|
+
isSyncingSelectionToFabricRef.current = false;
|
|
11250
|
+
});
|
|
11251
|
+
}
|
|
11252
|
+
}, [applyLogicalGroupSelectionVisualState]);
|
|
11247
11253
|
const currentPage = useMemo(() => (canvas.pages ?? []).find((p) => p.id === pageId), [canvas.pages, pageId]);
|
|
11248
11254
|
useMemo(() => {
|
|
11249
11255
|
const ids = storeSelectedIds ?? [];
|
|
@@ -11555,7 +11561,6 @@ const PageCanvas = forwardRef(
|
|
|
11555
11561
|
fc.__isUserTransforming = true;
|
|
11556
11562
|
didTransformRef.current = true;
|
|
11557
11563
|
lastResizeScaleTargetRef.current = target;
|
|
11558
|
-
lastResizeScaleCornerRef.current = corner;
|
|
11559
11564
|
const targetId = getObjectId(target);
|
|
11560
11565
|
if (targetId && targetId !== "__background__") {
|
|
11561
11566
|
preserveSelectionAfterTransformIdRef.current = targetId;
|
|
@@ -12039,9 +12044,6 @@ const PageCanvas = forwardRef(
|
|
|
12039
12044
|
selectionLeft: rect.left,
|
|
12040
12045
|
selectionTop: rect.top
|
|
12041
12046
|
};
|
|
12042
|
-
if (active.__pixldocsGroupSelection) {
|
|
12043
|
-
prepareGroupSelectionTransformStart(active);
|
|
12044
|
-
}
|
|
12045
12047
|
}
|
|
12046
12048
|
if (fabricCanvas._currentTransform) {
|
|
12047
12049
|
fabricCanvas.__isUserTransforming = true;
|
|
@@ -12482,8 +12484,11 @@ const PageCanvas = forwardRef(
|
|
|
12482
12484
|
if (shouldRestoreGroupSelection) restorePreservedGroupSelectionSoon(preservedGroupSelection);
|
|
12483
12485
|
return;
|
|
12484
12486
|
}
|
|
12485
|
-
|
|
12487
|
+
const recentGroupSelectionRestore = recentGroupSelectionRestoreRef.current;
|
|
12488
|
+
const shouldReassertRecentGroupSelection = !!((recentGroupSelectionRestore == null ? void 0 : recentGroupSelectionRestore.groupSelectionId) && recentGroupSelectionRestore.expiresAt > Date.now());
|
|
12489
|
+
if (editLockRef.current || syncLockedRef.current || didTransformRef.current || preserveSelectionAfterTransformIdRef.current || shouldRestoreGroupSelection || shouldReassertRecentGroupSelection) {
|
|
12486
12490
|
if (shouldRestoreGroupSelection) restorePreservedGroupSelectionSoon(preservedGroupSelection);
|
|
12491
|
+
else if (shouldReassertRecentGroupSelection) restorePreservedGroupSelectionSoon(recentGroupSelectionRestore);
|
|
12487
12492
|
return;
|
|
12488
12493
|
}
|
|
12489
12494
|
restoreSuppressedGroupBorders();
|
|
@@ -12699,34 +12704,11 @@ const PageCanvas = forwardRef(
|
|
|
12699
12704
|
const restorePreservedGroupSelectionSoon = (snapshot = preserveActiveSelectionAfterTransformRef.current) => {
|
|
12700
12705
|
if (!(snapshot == null ? void 0 : snapshot.groupSelectionId) || snapshot.memberIds.length < 2) return;
|
|
12701
12706
|
const groupId = snapshot.groupSelectionId;
|
|
12702
|
-
const memberIds = [...snapshot.memberIds];
|
|
12703
12707
|
selectElements([groupId], false, false);
|
|
12704
12708
|
requestAnimationFrame(() => {
|
|
12705
12709
|
setTimeout(() => {
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
const active = fc.getActiveObject();
|
|
12709
|
-
if (active instanceof fabric.ActiveSelection && active.__pixldocsGroupSelection === groupId) {
|
|
12710
|
-
restoreGroupSelectionVisualState(active, groupId);
|
|
12711
|
-
fc.requestRenderAll();
|
|
12712
|
-
return;
|
|
12713
|
-
}
|
|
12714
|
-
const members = memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
|
|
12715
|
-
if (members.length < 2) return;
|
|
12716
|
-
isSyncingSelectionToFabricRef.current = true;
|
|
12717
|
-
try {
|
|
12718
|
-
const selection = new fabric.ActiveSelection(members, { canvas: fc });
|
|
12719
|
-
restoreGroupSelectionVisualState(selection, groupId);
|
|
12720
|
-
fc.setActiveObject(selection);
|
|
12721
|
-
if (!selection.getObjects().every((obj) => !(obj instanceof fabric.Group))) {
|
|
12722
|
-
selection.setCoords();
|
|
12723
|
-
}
|
|
12724
|
-
fc.requestRenderAll();
|
|
12725
|
-
} finally {
|
|
12726
|
-
requestAnimationFrame(() => {
|
|
12727
|
-
isSyncingSelectionToFabricRef.current = false;
|
|
12728
|
-
});
|
|
12729
|
-
}
|
|
12710
|
+
if (!isActiveRef.current) return;
|
|
12711
|
+
restoreGroupSelectionSnapshot(snapshot);
|
|
12730
12712
|
}, 0);
|
|
12731
12713
|
});
|
|
12732
12714
|
};
|
|
@@ -12909,9 +12891,6 @@ const PageCanvas = forwardRef(
|
|
|
12909
12891
|
fabricCanvas.on("mouse:down:before", (opt) => {
|
|
12910
12892
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
12911
12893
|
const activeBeforeMouseDown = fabricCanvas.getActiveObject();
|
|
12912
|
-
if (activeBeforeMouseDown instanceof fabric.ActiveSelection && activeBeforeMouseDown.__pixldocsGroupSelection) {
|
|
12913
|
-
prepareGroupSelectionTransformStart(activeBeforeMouseDown);
|
|
12914
|
-
}
|
|
12915
12894
|
if (editLockRef.current) {
|
|
12916
12895
|
const active = fabricCanvas.getActiveObject();
|
|
12917
12896
|
if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
|
|
@@ -13026,14 +13005,7 @@ const PageCanvas = forwardRef(
|
|
|
13026
13005
|
pendingGroupDrillInRef.current = null;
|
|
13027
13006
|
} else if (drillGroup && !drillGroup.backgroundColor && !targetIsInCrop && alreadyThisGroup && !isMultiSelectKey && effectiveTarget !== activeNow) {
|
|
13028
13007
|
pendingGroupPromotionRef.current = null;
|
|
13029
|
-
|
|
13030
|
-
pendingGroupDrillInRef.current = {
|
|
13031
|
-
groupId: drillGroup.id,
|
|
13032
|
-
childId: effectiveTargetId,
|
|
13033
|
-
target: effectiveTarget,
|
|
13034
|
-
startX: pointer.x,
|
|
13035
|
-
startY: pointer.y
|
|
13036
|
-
};
|
|
13008
|
+
pendingGroupDrillInRef.current = { groupId: drillGroup.id, childId: effectiveTargetId, target: effectiveTarget };
|
|
13037
13009
|
if (effectiveTarget instanceof fabric.Textbox) {
|
|
13038
13010
|
suppressTextEditForClick(effectiveTarget);
|
|
13039
13011
|
}
|
|
@@ -13180,7 +13152,7 @@ const PageCanvas = forwardRef(
|
|
|
13180
13152
|
o.__lockScaleDuringCrop = false;
|
|
13181
13153
|
});
|
|
13182
13154
|
fabricCanvas.on("mouse:up", (e) => {
|
|
13183
|
-
var _a2, _b2, _c
|
|
13155
|
+
var _a2, _b2, _c;
|
|
13184
13156
|
clearTransforming();
|
|
13185
13157
|
setGuides([]);
|
|
13186
13158
|
setRotationLabel(null);
|
|
@@ -13190,21 +13162,7 @@ const PageCanvas = forwardRef(
|
|
|
13190
13162
|
dragStarted = false;
|
|
13191
13163
|
const pendingDrillIn = pendingGroupDrillInRef.current;
|
|
13192
13164
|
pendingGroupDrillInRef.current = null;
|
|
13193
|
-
|
|
13194
|
-
if (pendingDrillIn && pendingDrillIn.startX !== void 0 && pendingDrillIn.startY !== void 0) {
|
|
13195
|
-
try {
|
|
13196
|
-
const pointer = fabricCanvas.getPointer(e == null ? void 0 : e.e);
|
|
13197
|
-
const zoom3 = ((_a2 = fabricCanvas.getZoom) == null ? void 0 : _a2.call(fabricCanvas)) || 1;
|
|
13198
|
-
const dragThreshold = Math.max(2, 4 / zoom3);
|
|
13199
|
-
movedPendingDrillPointer = Math.hypot(pointer.x - pendingDrillIn.startX, pointer.y - pendingDrillIn.startY) > dragThreshold;
|
|
13200
|
-
} catch {
|
|
13201
|
-
movedPendingDrillPointer = false;
|
|
13202
|
-
}
|
|
13203
|
-
}
|
|
13204
|
-
if (movedPendingDrillPointer) {
|
|
13205
|
-
didTransformRef.current = true;
|
|
13206
|
-
}
|
|
13207
|
-
if (pendingDrillIn && (didTransformRef.current || movedPendingDrillPointer)) {
|
|
13165
|
+
if (pendingDrillIn && didTransformRef.current) {
|
|
13208
13166
|
const activeNow = fabricCanvas.getActiveObject();
|
|
13209
13167
|
fabricCanvas.__activeEditingGroupId = null;
|
|
13210
13168
|
setDrilledGroupBounds(null);
|
|
@@ -13220,7 +13178,8 @@ const PageCanvas = forwardRef(
|
|
|
13220
13178
|
if (memberIds.length > 1) {
|
|
13221
13179
|
restorePreservedGroupSelectionSoon({
|
|
13222
13180
|
memberIds,
|
|
13223
|
-
groupSelectionId: pendingDrillIn.groupId
|
|
13181
|
+
groupSelectionId: pendingDrillIn.groupId,
|
|
13182
|
+
expiresAt: Date.now() + 1200
|
|
13224
13183
|
});
|
|
13225
13184
|
} else {
|
|
13226
13185
|
selectElements([pendingDrillIn.groupId], false, false);
|
|
@@ -13234,7 +13193,7 @@ const PageCanvas = forwardRef(
|
|
|
13234
13193
|
fabricCanvas.__activeEditingGroupId = pendingDrillIn.groupId;
|
|
13235
13194
|
delete pendingDrillIn.target.__pixldocsGroupSelection;
|
|
13236
13195
|
delete pendingDrillIn.target.__pixldocsLogicalGroupIds;
|
|
13237
|
-
(
|
|
13196
|
+
(_b2 = (_a2 = pendingDrillIn.target).set) == null ? void 0 : _b2.call(_a2, { selectable: true, evented: true, hasBorders: true, hasControls: true });
|
|
13238
13197
|
fabricCanvas.setActiveObject(pendingDrillIn.target);
|
|
13239
13198
|
pendingDrillIn.target.setCoords();
|
|
13240
13199
|
if (pendingDrillIn.target instanceof fabric.Textbox) {
|
|
@@ -13287,7 +13246,7 @@ const PageCanvas = forwardRef(
|
|
|
13287
13246
|
}
|
|
13288
13247
|
}
|
|
13289
13248
|
const activeObj = fabricCanvas.getActiveObject();
|
|
13290
|
-
if (activeObj && (activeObj.__cropGroup || ((
|
|
13249
|
+
if (activeObj && (activeObj.__cropGroup || ((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup))) {
|
|
13291
13250
|
activeObj.__lockScaleDuringCrop = false;
|
|
13292
13251
|
if (activeObj.__cropDrag) {
|
|
13293
13252
|
delete activeObj.__cropDrag;
|
|
@@ -13305,9 +13264,7 @@ const PageCanvas = forwardRef(
|
|
|
13305
13264
|
syncLockedRef.current = false;
|
|
13306
13265
|
}, 50);
|
|
13307
13266
|
}
|
|
13308
|
-
|
|
13309
|
-
didTransformRef.current = false;
|
|
13310
|
-
});
|
|
13267
|
+
didTransformRef.current = false;
|
|
13311
13268
|
setTimeout(() => {
|
|
13312
13269
|
if (!fabricCanvas._currentTransform) {
|
|
13313
13270
|
editLockRef.current = false;
|
|
@@ -13385,11 +13342,10 @@ const PageCanvas = forwardRef(
|
|
|
13385
13342
|
fabricCanvas.on("selection:cleared", () => {
|
|
13386
13343
|
});
|
|
13387
13344
|
fabricCanvas.on("object:scaling", (e) => {
|
|
13388
|
-
var _a2
|
|
13345
|
+
var _a2;
|
|
13389
13346
|
if (!isActiveRef.current) return;
|
|
13390
13347
|
const t = e.target;
|
|
13391
13348
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
13392
|
-
lastResizeScaleCornerRef.current = ((_a2 = e.transform) == null ? void 0 : _a2.corner) ?? null;
|
|
13393
13349
|
prepareGroupSelectionTransformStart(t);
|
|
13394
13350
|
markTransforming(t);
|
|
13395
13351
|
didTransformRef.current = true;
|
|
@@ -13707,17 +13663,16 @@ const PageCanvas = forwardRef(
|
|
|
13707
13663
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
13708
13664
|
if (drilledGroupIdRef.current) {
|
|
13709
13665
|
try {
|
|
13710
|
-
(
|
|
13666
|
+
(_a2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fabricCanvas);
|
|
13711
13667
|
} catch {
|
|
13712
13668
|
}
|
|
13713
13669
|
}
|
|
13714
13670
|
});
|
|
13715
13671
|
fabricCanvas.on("object:resizing", (e) => {
|
|
13716
|
-
var _a2
|
|
13672
|
+
var _a2;
|
|
13717
13673
|
if (!isActiveRef.current) return;
|
|
13718
13674
|
const t = e.target;
|
|
13719
13675
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
13720
|
-
lastResizeScaleCornerRef.current = ((_a2 = e.transform) == null ? void 0 : _a2.corner) ?? null;
|
|
13721
13676
|
markTransforming(t);
|
|
13722
13677
|
didTransformRef.current = true;
|
|
13723
13678
|
const transformTargetId = t ? getObjectId(t) : null;
|
|
@@ -13793,7 +13748,7 @@ const PageCanvas = forwardRef(
|
|
|
13793
13748
|
setGuides(gridGuidesForTextResize.length ? [...scaleGuides, ...gridGuidesForTextResize] : scaleGuides);
|
|
13794
13749
|
if (drilledGroupIdRef.current) {
|
|
13795
13750
|
try {
|
|
13796
|
-
(
|
|
13751
|
+
(_a2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fabricCanvas);
|
|
13797
13752
|
} catch {
|
|
13798
13753
|
}
|
|
13799
13754
|
}
|
|
@@ -13837,26 +13792,19 @@ const PageCanvas = forwardRef(
|
|
|
13837
13792
|
const activeDuringMove = fabricCanvas.getActiveObject();
|
|
13838
13793
|
const movingLogicalGroupId = activeDuringMove instanceof fabric.ActiveSelection ? activeDuringMove.__pixldocsGroupSelection : void 0;
|
|
13839
13794
|
const pendingMoveDrill = pendingGroupDrillInRef.current;
|
|
13840
|
-
const groupIdToKeep = movingLogicalGroupId ?? (pendingMoveDrill == null ? void 0 : pendingMoveDrill.groupId);
|
|
13841
13795
|
if (movingLogicalGroupId || pendingMoveDrill) {
|
|
13796
|
+
const groupIdToKeep = movingLogicalGroupId ?? (pendingMoveDrill == null ? void 0 : pendingMoveDrill.groupId);
|
|
13842
13797
|
pendingGroupDrillInRef.current = null;
|
|
13843
13798
|
fabricCanvas.__activeEditingGroupId = null;
|
|
13844
13799
|
setDrilledGroupBounds(null);
|
|
13845
13800
|
drilledGroupIdRef.current = null;
|
|
13846
13801
|
if (activeDuringMove instanceof fabric.ActiveSelection && groupIdToKeep) {
|
|
13847
13802
|
restoreGroupSelectionVisualState(activeDuringMove, groupIdToKeep);
|
|
13848
|
-
const memberIds = activeDuringMove.getObjects().map((obj2) => getObjectId(obj2)).filter((id) => !!id && id !== "__background__");
|
|
13849
|
-
if (memberIds.length > 1) {
|
|
13850
|
-
preserveActiveSelectionAfterTransformRef.current = { memberIds, groupSelectionId: groupIdToKeep, expiresAt: Date.now() + 1200 };
|
|
13851
|
-
}
|
|
13852
|
-
preserveSelectionAfterTransformIdRef.current = groupIdToKeep;
|
|
13853
13803
|
}
|
|
13854
13804
|
}
|
|
13855
13805
|
if (e.target) e.target.__pixldocsDragMoved = true;
|
|
13856
13806
|
const moveTargetId = e.target ? getObjectId(e.target) : null;
|
|
13857
|
-
if (
|
|
13858
|
-
preserveSelectionAfterTransformIdRef.current = groupIdToKeep;
|
|
13859
|
-
} else if (moveTargetId && moveTargetId !== "__background__") {
|
|
13807
|
+
if (moveTargetId && moveTargetId !== "__background__") {
|
|
13860
13808
|
preserveSelectionAfterTransformIdRef.current = moveTargetId;
|
|
13861
13809
|
}
|
|
13862
13810
|
if (!dragStarted) {
|
|
@@ -13903,34 +13851,10 @@ const PageCanvas = forwardRef(
|
|
|
13903
13851
|
}
|
|
13904
13852
|
});
|
|
13905
13853
|
let cropGroupSaveTimer = null;
|
|
13906
|
-
let objectModifiedInFlight = false;
|
|
13907
13854
|
fabricCanvas.on("object:modified", (e) => {
|
|
13908
|
-
var _a2, _b2, _c, _d, _e, _f, _g
|
|
13909
|
-
if (objectModifiedInFlight) {
|
|
13910
|
-
if (shouldLogGroupMove()) {
|
|
13911
|
-
console.log("[GRP-MOVE] object:modified re-entry skipped", {
|
|
13912
|
-
targetType: (_b2 = (_a2 = e.target) == null ? void 0 : _a2.constructor) == null ? void 0 : _b2.name
|
|
13913
|
-
});
|
|
13914
|
-
}
|
|
13915
|
-
return;
|
|
13916
|
-
}
|
|
13917
|
-
objectModifiedInFlight = true;
|
|
13855
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
13918
13856
|
try {
|
|
13919
13857
|
dragStarted = false;
|
|
13920
|
-
if (shouldLogGroupMove()) {
|
|
13921
|
-
const t = e.target;
|
|
13922
|
-
console.log("[GRP-MOVE] object:modified fired", {
|
|
13923
|
-
targetType: (_c = t == null ? void 0 : t.constructor) == null ? void 0 : _c.name,
|
|
13924
|
-
isActiveSelection: t instanceof fabric.ActiveSelection,
|
|
13925
|
-
groupSelectionId: t ? t.__pixldocsGroupSelection : null,
|
|
13926
|
-
memberIds: t instanceof fabric.ActiveSelection ? t.getObjects().map((o) => getObjectId(o)) : [getObjectId(t)],
|
|
13927
|
-
targetLeft: t == null ? void 0 : t.left,
|
|
13928
|
-
targetTop: t == null ? void 0 : t.top,
|
|
13929
|
-
scaleX: t == null ? void 0 : t.scaleX,
|
|
13930
|
-
scaleY: t == null ? void 0 : t.scaleY,
|
|
13931
|
-
angle: t == null ? void 0 : t.angle
|
|
13932
|
-
});
|
|
13933
|
-
}
|
|
13934
13858
|
setGuides([]);
|
|
13935
13859
|
setGroupOverlayLiveBoundsRef.current(null);
|
|
13936
13860
|
objectResizeActiveSnapRef.current = null;
|
|
@@ -13972,7 +13896,7 @@ const PageCanvas = forwardRef(
|
|
|
13972
13896
|
const active = fabricCanvas.getActiveObject();
|
|
13973
13897
|
const activeId = active ? getObjectId(active) : null;
|
|
13974
13898
|
if (active && activeId && activeId !== "__background__" && !(active instanceof fabric.Group)) {
|
|
13975
|
-
const pageChildrenForParent = ((
|
|
13899
|
+
const pageChildrenForParent = ((_a2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _a2.children) ?? [];
|
|
13976
13900
|
const parentGroup = findParentGroup(pageChildrenForParent, activeId);
|
|
13977
13901
|
if (parentGroup && isGroup(parentGroup) && parentGroup.backgroundColor) {
|
|
13978
13902
|
let fabricSectionGroup = active.group && active.group instanceof fabric.Group ? active.group : null;
|
|
@@ -14054,7 +13978,7 @@ const PageCanvas = forwardRef(
|
|
|
14054
13978
|
useEditorStore.getState().reflowStackGroupInPage(pageId, groupId);
|
|
14055
13979
|
}
|
|
14056
13980
|
const stateAfter = useEditorStore.getState();
|
|
14057
|
-
const pageAfter = ((
|
|
13981
|
+
const pageAfter = ((_b2 = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _b2.children) ?? [];
|
|
14058
13982
|
const groupNodeAfter = findNodeById(pageAfter, groupId);
|
|
14059
13983
|
if (groupNodeAfter) {
|
|
14060
13984
|
const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
|
|
@@ -14116,7 +14040,7 @@ const PageCanvas = forwardRef(
|
|
|
14116
14040
|
}
|
|
14117
14041
|
if (active && active instanceof fabric.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
|
|
14118
14042
|
const groupId = getObjectId(active);
|
|
14119
|
-
const pageChildrenSec = ((
|
|
14043
|
+
const pageChildrenSec = ((_c = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
|
|
14120
14044
|
const modifiedTarget2 = e == null ? void 0 : e.target;
|
|
14121
14045
|
const resizeScaleTarget = lastResizeScaleTargetRef.current;
|
|
14122
14046
|
lastResizeScaleTargetRef.current = null;
|
|
@@ -14147,7 +14071,7 @@ const PageCanvas = forwardRef(
|
|
|
14147
14071
|
const node = findNodeById(pageChildrenSec, groupId);
|
|
14148
14072
|
if (isChildModified && node && !groupMoved) {
|
|
14149
14073
|
const stateAfter = useEditorStore.getState();
|
|
14150
|
-
const pageAfter = ((
|
|
14074
|
+
const pageAfter = ((_d = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
|
|
14151
14075
|
const groupNodeAfter = findNodeById(pageAfter, groupId);
|
|
14152
14076
|
if (groupNodeAfter) {
|
|
14153
14077
|
const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
|
|
@@ -14163,7 +14087,7 @@ const PageCanvas = forwardRef(
|
|
|
14163
14087
|
}
|
|
14164
14088
|
if (active && active instanceof fabric.Group && !(active instanceof fabric.ActiveSelection) && getObjectId(active)) {
|
|
14165
14089
|
const groupId = getObjectId(active);
|
|
14166
|
-
const pageChildren3 = ((
|
|
14090
|
+
const pageChildren3 = ((_e = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
|
|
14167
14091
|
const w = (active.width ?? 0) * (active.scaleX ?? 1);
|
|
14168
14092
|
const h = (active.height ?? 0) * (active.scaleY ?? 1);
|
|
14169
14093
|
const centerX = active.left ?? 0;
|
|
@@ -14185,7 +14109,7 @@ const PageCanvas = forwardRef(
|
|
|
14185
14109
|
}
|
|
14186
14110
|
const activeObj = fabricCanvas.getActiveObject();
|
|
14187
14111
|
let activeObjects = fabricCanvas.getActiveObjects();
|
|
14188
|
-
const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((
|
|
14112
|
+
const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_f = activeSelectionMoveStartRef.current) == null ? void 0 : _f.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
|
|
14189
14113
|
const activeSelectionDelta = activeObj instanceof fabric.ActiveSelection && activeSelectionMoveStart ? (() => {
|
|
14190
14114
|
const rect = activeObj.getBoundingRect();
|
|
14191
14115
|
return {
|
|
@@ -14276,22 +14200,6 @@ const PageCanvas = forwardRef(
|
|
|
14276
14200
|
return memberIds.every((mid) => selectedSet.has(mid));
|
|
14277
14201
|
})();
|
|
14278
14202
|
const groupToMove = candidateIsStack || allMembersSelected ? candidateGroup : null;
|
|
14279
|
-
if (shouldLogGroupMove()) {
|
|
14280
|
-
console.log("[GRP-MOVE] entry", {
|
|
14281
|
-
selectedElementIds,
|
|
14282
|
-
isActiveSelection,
|
|
14283
|
-
activeSelectionGroupId: activeObj instanceof fabric.ActiveSelection ? activeObj.__pixldocsGroupSelection : null,
|
|
14284
|
-
parentGroupIds: parentGroups.map((g) => g.id),
|
|
14285
|
-
sameDirectParent,
|
|
14286
|
-
commonAncestorId: commonAncestor == null ? void 0 : commonAncestor.id,
|
|
14287
|
-
candidateGroupId: candidateGroup == null ? void 0 : candidateGroup.id,
|
|
14288
|
-
candidateIsStack,
|
|
14289
|
-
allMembersSelected,
|
|
14290
|
-
groupToMoveId: (groupToMove == null ? void 0 : groupToMove.id) ?? null,
|
|
14291
|
-
activeSelectionHadTransform,
|
|
14292
|
-
selectedLogicalGroupIds
|
|
14293
|
-
});
|
|
14294
|
-
}
|
|
14295
14203
|
if (groupToMove) {
|
|
14296
14204
|
const activeGroupSelectionId = activeObj instanceof fabric.ActiveSelection ? activeObj.__pixldocsGroupSelection : void 0;
|
|
14297
14205
|
const transformStart = activeGroupSelectionId === groupToMove.id ? groupSelectionTransformStartRef.current : null;
|
|
@@ -14349,18 +14257,6 @@ const PageCanvas = forwardRef(
|
|
|
14349
14257
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14350
14258
|
const newLeft = (groupToMove.left ?? 0) + deltaX;
|
|
14351
14259
|
const newTop = (groupToMove.top ?? 0) + deltaY;
|
|
14352
|
-
const __dbg = shouldLogGroupMove();
|
|
14353
|
-
if (__dbg) {
|
|
14354
|
-
console.log("[GRP-MOVE] commit", {
|
|
14355
|
-
groupId: groupToMove.id,
|
|
14356
|
-
groupAbs,
|
|
14357
|
-
movedGroup: { left: movedGroupLeft, top: movedGroupTop },
|
|
14358
|
-
delta: { x: deltaX, y: deltaY },
|
|
14359
|
-
newStored: { left: newLeft, top: newTop },
|
|
14360
|
-
activeSelectionAngle: isActiveSelection && activeObj ? activeObj.angle : null,
|
|
14361
|
-
hasGroupSelectionId: !!(isActiveSelection && activeObj instanceof fabric.ActiveSelection && activeObj.__pixldocsGroupSelection)
|
|
14362
|
-
});
|
|
14363
|
-
}
|
|
14364
14260
|
updateNodeStore(groupToMove.id, { left: newLeft, top: newTop }, { recordHistory: false, skipLayoutRecalc: true });
|
|
14365
14261
|
commitHistoryStore();
|
|
14366
14262
|
pendingGroupDrillInRef.current = null;
|
|
@@ -14386,11 +14282,13 @@ const PageCanvas = forwardRef(
|
|
|
14386
14282
|
}
|
|
14387
14283
|
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14388
14284
|
groupSelectionTransformStartRef.current = null;
|
|
14389
|
-
|
|
14390
|
-
restorePreservedGroupSelectionSoon({
|
|
14285
|
+
const restoreSnapshot = {
|
|
14391
14286
|
memberIds: targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__"),
|
|
14392
|
-
groupSelectionId
|
|
14393
|
-
|
|
14287
|
+
groupSelectionId,
|
|
14288
|
+
expiresAt: Date.now() + 1200
|
|
14289
|
+
};
|
|
14290
|
+
recentGroupSelectionRestoreRef.current = restoreSnapshot;
|
|
14291
|
+
restorePreservedGroupSelectionSoon(restoreSnapshot);
|
|
14394
14292
|
unlockEditsSoon();
|
|
14395
14293
|
return;
|
|
14396
14294
|
}
|
|
@@ -14558,8 +14456,6 @@ const PageCanvas = forwardRef(
|
|
|
14558
14456
|
} else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
14559
14457
|
const sx = Math.abs(decomposed.scaleX || 1);
|
|
14560
14458
|
const sy = Math.abs(decomposed.scaleY || 1);
|
|
14561
|
-
const lastCorner = lastResizeScaleCornerRef.current ?? "";
|
|
14562
|
-
const isCornerGroupScale = lastCorner === "tl" || lastCorner === "tr" || lastCorner === "bl" || lastCorner === "br";
|
|
14563
14459
|
const bakedWidth = Math.max(20, intrinsicWidth * sx);
|
|
14564
14460
|
const bakedHeight = Math.max(1, intrinsicHeight * sy);
|
|
14565
14461
|
finalWidth = bakedWidth;
|
|
@@ -14567,13 +14463,8 @@ const PageCanvas = forwardRef(
|
|
|
14567
14463
|
finalScaleX = 1;
|
|
14568
14464
|
finalScaleY = 1;
|
|
14569
14465
|
try {
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
} else {
|
|
14573
|
-
obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1 });
|
|
14574
|
-
obj.minBoxHeight = bakedHeight;
|
|
14575
|
-
obj.initDimensions();
|
|
14576
|
-
}
|
|
14466
|
+
obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1 });
|
|
14467
|
+
obj.initDimensions();
|
|
14577
14468
|
obj.setCoords();
|
|
14578
14469
|
} catch {
|
|
14579
14470
|
}
|
|
@@ -14652,7 +14543,7 @@ const PageCanvas = forwardRef(
|
|
|
14652
14543
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
14653
14544
|
obj.setCoords();
|
|
14654
14545
|
}
|
|
14655
|
-
const pageChildrenForReflow = ((
|
|
14546
|
+
const pageChildrenForReflow = ((_g = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _g.children) ?? [];
|
|
14656
14547
|
const stackGroupsToReflow = /* @__PURE__ */ new Set();
|
|
14657
14548
|
for (const id of modifiedIdsThisRound) {
|
|
14658
14549
|
const parent = findParentGroup(pageChildrenForReflow, id);
|
|
@@ -14714,15 +14605,11 @@ const PageCanvas = forwardRef(
|
|
|
14714
14605
|
}
|
|
14715
14606
|
groupSelectionTransformStartRef.current = null;
|
|
14716
14607
|
activeSelectionMoveStartRef.current = null;
|
|
14717
|
-
lastResizeScaleCornerRef.current = null;
|
|
14718
14608
|
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14719
14609
|
commitHistory();
|
|
14720
14610
|
unlockEditsSoon();
|
|
14721
14611
|
} catch (e2) {
|
|
14722
|
-
lastResizeScaleCornerRef.current = null;
|
|
14723
14612
|
unlockEditsSoon();
|
|
14724
|
-
} finally {
|
|
14725
|
-
objectModifiedInFlight = false;
|
|
14726
14613
|
}
|
|
14727
14614
|
});
|
|
14728
14615
|
fabricCanvas.on("before:selection:cleared", (e) => {
|
|
@@ -14980,14 +14867,13 @@ const PageCanvas = forwardRef(
|
|
|
14980
14867
|
visibilityUpdateInProgressRef.current = false;
|
|
14981
14868
|
}
|
|
14982
14869
|
doSyncRef.current = () => {
|
|
14983
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
14870
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
14984
14871
|
const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
|
|
14985
14872
|
const state = useEditorStore.getState();
|
|
14986
|
-
const
|
|
14987
|
-
const pageTree = isPreviewMode && (pageChildren == null ? void 0 : pageChildren.length) ? pageChildren ?? [] : (storePage == null ? void 0 : storePage.children) ?? [];
|
|
14988
|
-
const elementsToSync = isPreviewMode ? elements : pageTree.length ? flattenChildren(pageTree) : elements;
|
|
14873
|
+
const elementsToSync = elements;
|
|
14989
14874
|
elementsRef.current = elementsToSync;
|
|
14990
|
-
const
|
|
14875
|
+
const pageTree = isPreviewMode && (pageChildren == null ? void 0 : pageChildren.length) ? pageChildren ?? [] : ((_a2 = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _a2.children) ?? [];
|
|
14876
|
+
const selectedIdsFromStore = new Set(((_b2 = state.canvas) == null ? void 0 : _b2.selectedIds) ?? []);
|
|
14991
14877
|
isRebuildingRef.current = true;
|
|
14992
14878
|
const allElementIds = new Set(elementsToSync.map((el) => el.id));
|
|
14993
14879
|
const sectionGroups = pageTree.filter(
|
|
@@ -15015,7 +14901,7 @@ const PageCanvas = forwardRef(
|
|
|
15015
14901
|
const activeObjId = activeObj ? getObjectId(activeObj) : null;
|
|
15016
14902
|
const isTextBeingEdited = activeObjId && editingTextIdRef.current === activeObjId;
|
|
15017
14903
|
const isMultiSelect = activeObj instanceof fabric.ActiveSelection;
|
|
15018
|
-
if (activeObj && isMultiSelect && !(((
|
|
14904
|
+
if (activeObj && isMultiSelect && !(((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
|
|
15019
14905
|
fc.discardActiveObject();
|
|
15020
14906
|
}
|
|
15021
14907
|
}
|
|
@@ -15052,7 +14938,7 @@ const PageCanvas = forwardRef(
|
|
|
15052
14938
|
fc.requestRenderAll();
|
|
15053
14939
|
}
|
|
15054
14940
|
} else if (!skipRestoreSelection && restoreTarget && !isActiveTextBeingEdited) {
|
|
15055
|
-
const isCropGroup2 = ((
|
|
14941
|
+
const isCropGroup2 = ((_d = restoreTarget._ct) == null ? void 0 : _d.isCropGroup) || restoreTarget.__cropGroup;
|
|
15056
14942
|
const isSectionGroup = activeId && sectionGroupIds.has(activeId);
|
|
15057
14943
|
if ((isCropGroup2 || !shouldSkipUpdates2) && !isSectionGroup) {
|
|
15058
14944
|
fc.setActiveObject(restoreTarget);
|
|
@@ -15157,42 +15043,9 @@ const PageCanvas = forwardRef(
|
|
|
15157
15043
|
};
|
|
15158
15044
|
fc.add(sectionGroup);
|
|
15159
15045
|
}
|
|
15160
|
-
const getActiveSelectionContainingObject = (obj) => {
|
|
15161
|
-
const active = fc.getActiveObject();
|
|
15162
|
-
return active instanceof fabric.ActiveSelection && active.getObjects().includes(obj) ? active : null;
|
|
15163
|
-
};
|
|
15164
|
-
const shouldPreserveActiveSelectionMemberPosition = (obj) => {
|
|
15165
|
-
if (syncTriggeredByPanelRef.current) return false;
|
|
15166
|
-
const activeSelection = getActiveSelectionContainingObject(obj);
|
|
15167
|
-
if (!activeSelection) return false;
|
|
15168
|
-
const logicalActiveSelection = activeSelection;
|
|
15169
|
-
const logicalGroupId = logicalActiveSelection.__pixldocsGroupSelection;
|
|
15170
|
-
const logicalGroupIds = logicalActiveSelection.__pixldocsLogicalGroupIds;
|
|
15171
|
-
if (logicalGroupId || Array.isArray(logicalGroupIds)) return true;
|
|
15172
|
-
const id = getObjectId(obj);
|
|
15173
|
-
const preserved = preserveActiveSelectionAfterTransformRef.current;
|
|
15174
|
-
return !!(id && (preserved == null ? void 0 : preserved.memberIds.includes(id)) && (!preserved.expiresAt || preserved.expiresAt > Date.now()));
|
|
15175
|
-
};
|
|
15176
|
-
const getObjectSyncComparePosition = (obj) => {
|
|
15177
|
-
const activeSelection = getActiveSelectionContainingObject(obj);
|
|
15178
|
-
if (!activeSelection) return { left: obj.left ?? 0, top: obj.top ?? 0 };
|
|
15179
|
-
const point = fabric.util.transformPoint({ x: obj.left ?? 0, y: obj.top ?? 0 }, activeSelection.calcTransformMatrix());
|
|
15180
|
-
let left = point.x;
|
|
15181
|
-
let top = point.y;
|
|
15182
|
-
const cropObj = obj;
|
|
15183
|
-
if (obj instanceof fabric.Group && cropObj.__cropGroup) {
|
|
15184
|
-
const ct = cropObj.__cropData;
|
|
15185
|
-
left -= ((ct == null ? void 0 : ct.frameW) ?? obj.width ?? 0) * Math.abs(obj.scaleX ?? 1) / 2;
|
|
15186
|
-
top -= ((ct == null ? void 0 : ct.frameH) ?? obj.height ?? 0) * Math.abs(obj.scaleY ?? 1) / 2;
|
|
15187
|
-
} else if (obj instanceof fabric.FabricImage && (obj.originX === "center" || obj.originY === "center")) {
|
|
15188
|
-
left -= (obj.width ?? 0) * Math.abs(obj.scaleX ?? 1) / 2;
|
|
15189
|
-
top -= (obj.height ?? 0) * Math.abs(obj.scaleY ?? 1) / 2;
|
|
15190
|
-
}
|
|
15191
|
-
return { left, top };
|
|
15192
|
-
};
|
|
15193
15046
|
for (const element of elementsToSync) {
|
|
15194
15047
|
if (sectionDescendantIds.has(element.id)) continue;
|
|
15195
|
-
|
|
15048
|
+
let existingObj = currentFabricObjects.get(element.id);
|
|
15196
15049
|
const isHidden = !element.visible;
|
|
15197
15050
|
if (existingObj) {
|
|
15198
15051
|
const isBeingTransformed = transformingIdsRef.current.has(element.id);
|
|
@@ -15213,7 +15066,7 @@ const PageCanvas = forwardRef(
|
|
|
15213
15066
|
const sourceUrlChanged = currentUrlNormalized !== storedUrlNormalized;
|
|
15214
15067
|
const newFadeKey = edgeFadeKey(element);
|
|
15215
15068
|
const oldFadeKey = isCropGroup2 ? existingObj.__edgeFadeInputKey || "" : existingObj.__edgeFadeKey || "";
|
|
15216
|
-
const innerImg = (
|
|
15069
|
+
const innerImg = (_e = existingObj == null ? void 0 : existingObj.__cropData) == null ? void 0 : _e._img;
|
|
15217
15070
|
const innerOldKey = isCropGroup2 ? oldFadeKey : innerImg ? innerImg.__edgeFadeKey || "" : oldFadeKey;
|
|
15218
15071
|
const cropFadeRendererMissing = isCropGroup2 && Boolean(newFadeKey) && !existingObj.__edgeFadeRenderConfig;
|
|
15219
15072
|
const fadeKeyChanged = newFadeKey !== oldFadeKey || newFadeKey !== innerOldKey || cropFadeRendererMissing;
|
|
@@ -15221,14 +15074,14 @@ const PageCanvas = forwardRef(
|
|
|
15221
15074
|
const needsCropGroupFadeUpdate = isCropGroup2 && fadeKeyChanged;
|
|
15222
15075
|
const hadUrlBefore = storedImageUrl && String(storedImageUrl).trim() !== "";
|
|
15223
15076
|
if (!hasUrl && hadUrlBefore) {
|
|
15224
|
-
const resolvedSizeImg =
|
|
15077
|
+
const resolvedSizeImg = (pageChildren == null ? void 0 : pageChildren.length) ? getNodeBounds(element, pageChildren) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
|
|
15225
15078
|
const hasExplicitSize = typeof element.width === "number" && Number.isFinite(element.width) && element.width > 0 && typeof element.height === "number" && Number.isFinite(element.height) && element.height > 0;
|
|
15226
15079
|
const minVisiblePlaceholder = hasExplicitSize ? 1 : 20;
|
|
15227
15080
|
const nextWidth = Math.max(minVisiblePlaceholder, Number(resolvedSizeImg.width) || 200);
|
|
15228
15081
|
const nextHeight = Math.max(minVisiblePlaceholder, Number(resolvedSizeImg.height) || 50);
|
|
15229
|
-
const storePosImg =
|
|
15230
|
-
const node = findNodeById(
|
|
15231
|
-
return node ? getAbsoluteBounds(node,
|
|
15082
|
+
const storePosImg = pageChildren ? (() => {
|
|
15083
|
+
const node = findNodeById(pageChildren, element.id);
|
|
15084
|
+
return node ? getAbsoluteBounds(node, pageChildren) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15232
15085
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15233
15086
|
const elementForPlaceholder = { ...element, width: nextWidth, height: nextHeight };
|
|
15234
15087
|
const placeholder = isCropGroup2 ? createImagePlaceholderForGroup(elementForPlaceholder) : createImagePlaceholder(elementForPlaceholder);
|
|
@@ -15251,8 +15104,8 @@ const PageCanvas = forwardRef(
|
|
|
15251
15104
|
fc.requestRenderAll();
|
|
15252
15105
|
continue;
|
|
15253
15106
|
}
|
|
15254
|
-
const imageFitForReplace = element.imageFit || ((
|
|
15255
|
-
const clipShapeForReplace = element.clipShape ?? ((
|
|
15107
|
+
const imageFitForReplace = element.imageFit || ((_f = element.style) == null ? void 0 : _f.imageFit) || "cover";
|
|
15108
|
+
const clipShapeForReplace = element.clipShape ?? ((_g = element.style) == null ? void 0 : _g.imageFrameShape) ?? (isPreviewMode ? "rectangle" : "none");
|
|
15256
15109
|
const needCropGroupForElement = imageFitForReplace !== "fill" || clipShapeForReplace && clipShapeForReplace !== "none";
|
|
15257
15110
|
const plainImageNeedsCropGroup = hasUrl && !isCropGroup2 && existingObj instanceof fabric.FabricImage && needCropGroupForElement;
|
|
15258
15111
|
if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate)) {
|
|
@@ -15289,9 +15142,9 @@ const PageCanvas = forwardRef(
|
|
|
15289
15142
|
}
|
|
15290
15143
|
ct.rx = rxRatio;
|
|
15291
15144
|
}
|
|
15292
|
-
const cropPos =
|
|
15293
|
-
const node = findNodeById(
|
|
15294
|
-
return node ? getAbsoluteBounds(node,
|
|
15145
|
+
const cropPos = pageChildren ? (() => {
|
|
15146
|
+
const node = findNodeById(pageChildren, element.id);
|
|
15147
|
+
return node ? getAbsoluteBounds(node, pageChildren) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15295
15148
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15296
15149
|
const cropCenterX = cropPos.left + (ct.frameW ?? 0) / 2;
|
|
15297
15150
|
const cropCenterY = cropPos.top + (ct.frameH ?? 0) / 2;
|
|
@@ -15388,7 +15241,7 @@ const PageCanvas = forwardRef(
|
|
|
15388
15241
|
continue;
|
|
15389
15242
|
}
|
|
15390
15243
|
} else if (!hasUrl && !isPlaceholder) {
|
|
15391
|
-
const resolvedSizeImg =
|
|
15244
|
+
const resolvedSizeImg = (pageChildren == null ? void 0 : pageChildren.length) ? getNodeBounds(element, pageChildren) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
|
|
15392
15245
|
const hasExplicitSize = typeof element.width === "number" && Number.isFinite(element.width) && element.width > 0 && typeof element.height === "number" && Number.isFinite(element.height) && element.height > 0;
|
|
15393
15246
|
const minVisiblePlaceholder = hasExplicitSize ? 1 : 20;
|
|
15394
15247
|
const elementForPlaceholder = {
|
|
@@ -15418,11 +15271,11 @@ const PageCanvas = forwardRef(
|
|
|
15418
15271
|
placeholder.__imageSrc = void 0;
|
|
15419
15272
|
} else if (!isBeingTransformed && !isBeingTextEdited && !shouldSkipUpdates2) {
|
|
15420
15273
|
if (isPlaceholderGroup) {
|
|
15421
|
-
const storePosImg =
|
|
15422
|
-
const node = findNodeById(
|
|
15423
|
-
return node ? getAbsoluteBounds(node,
|
|
15274
|
+
const storePosImg = pageChildren ? (() => {
|
|
15275
|
+
const node = findNodeById(pageChildren, element.id);
|
|
15276
|
+
return node ? getAbsoluteBounds(node, pageChildren) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15424
15277
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15425
|
-
const resolvedSizeImg =
|
|
15278
|
+
const resolvedSizeImg = (pageChildren == null ? void 0 : pageChildren.length) ? getNodeBounds(element, pageChildren) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
|
|
15426
15279
|
const hasExplicitSize = typeof element.width === "number" && Number.isFinite(element.width) && element.width > 0 && typeof element.height === "number" && Number.isFinite(element.height) && element.height > 0;
|
|
15427
15280
|
const minVisiblePlaceholder = hasExplicitSize ? 1 : 20;
|
|
15428
15281
|
const nextWidth = Math.max(minVisiblePlaceholder, Number(resolvedSizeImg.width) || 200);
|
|
@@ -15482,13 +15335,11 @@ const PageCanvas = forwardRef(
|
|
|
15482
15335
|
const previousVisible = previousVisibilityRef.current.get(element.id) ?? true;
|
|
15483
15336
|
const currentVisible = element.visible !== false;
|
|
15484
15337
|
const visibilityChanged = previousVisible !== currentVisible;
|
|
15485
|
-
const storePosForImg =
|
|
15486
|
-
const node = findNodeById(
|
|
15487
|
-
return node ? getAbsoluteBounds(node,
|
|
15338
|
+
const storePosForImg = pageChildren ? (() => {
|
|
15339
|
+
const node = findNodeById(pageChildren, element.id);
|
|
15340
|
+
return node ? getAbsoluteBounds(node, pageChildren) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15488
15341
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15489
|
-
const
|
|
15490
|
-
const preserveSelectionMemberPosition = shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15491
|
-
const positionChanged = !preserveSelectionMemberPosition && (Math.abs(comparePosForImg.left - storePosForImg.left) > 0.1 || Math.abs(comparePosForImg.top - storePosForImg.top) > 0.1);
|
|
15342
|
+
const positionChanged = Math.abs((existingObj.left ?? 0) - storePosForImg.left) > 0.1 || Math.abs((existingObj.top ?? 0) - storePosForImg.top) > 0.1;
|
|
15492
15343
|
if (visibilityChanged && !positionChanged || visibilityUpdateInProgressRef.current) {
|
|
15493
15344
|
const isDynamicField = dynamicFieldIds.includes(element.id);
|
|
15494
15345
|
const canBeEvented = isEditorMode || isPreviewMode && isDynamicField;
|
|
@@ -15503,7 +15354,7 @@ const PageCanvas = forwardRef(
|
|
|
15503
15354
|
previousVisibilityRef.current.set(element.id, currentVisible);
|
|
15504
15355
|
} else {
|
|
15505
15356
|
if (!visibilityUpdateInProgressRef.current) {
|
|
15506
|
-
updateFabricObject(existingObj, element, wasJustModified
|
|
15357
|
+
updateFabricObject(existingObj, element, wasJustModified);
|
|
15507
15358
|
}
|
|
15508
15359
|
const isDynamicField = dynamicFieldIds.includes(element.id);
|
|
15509
15360
|
const canBeEvented = isEditorMode || isPreviewMode && isDynamicField;
|
|
@@ -15525,19 +15376,17 @@ const PageCanvas = forwardRef(
|
|
|
15525
15376
|
if (!isBeingTransformed && !isBeingTextEdited && !shouldSkipUpdates2) {
|
|
15526
15377
|
previousVisibilityRef.current.get(element.id) ?? true;
|
|
15527
15378
|
const currentVisible = element.visible !== false;
|
|
15528
|
-
const
|
|
15529
|
-
const
|
|
15530
|
-
const
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
return node ? getAbsoluteBounds(node, pageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15379
|
+
const fabricLeft = existingObj.left ?? 0;
|
|
15380
|
+
const fabricTop = existingObj.top ?? 0;
|
|
15381
|
+
const storePos = pageChildren ? (() => {
|
|
15382
|
+
const node = findNodeById(pageChildren, element.id);
|
|
15383
|
+
return node ? getAbsoluteBounds(node, pageChildren) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15534
15384
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15535
15385
|
const storeLeft = storePos.left;
|
|
15536
15386
|
const storeTop = storePos.top;
|
|
15537
15387
|
const deltaX = Math.abs(fabricLeft - storeLeft);
|
|
15538
15388
|
const deltaY = Math.abs(fabricTop - storeTop);
|
|
15539
|
-
|
|
15540
|
-
let positionChanged = !preserveSelectionMemberPosition && (deltaX > 0.1 || deltaY > 0.1);
|
|
15389
|
+
let positionChanged = deltaX > 0.1 || deltaY > 0.1;
|
|
15541
15390
|
const activeObj = fc.getActiveObject();
|
|
15542
15391
|
const isInActiveSelection = activeObj && (activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects().includes(existingObj) : activeObj === existingObj);
|
|
15543
15392
|
const isInSelectedIds = selectedIdsFromStore.has(element.id);
|
|
@@ -15545,7 +15394,7 @@ const PageCanvas = forwardRef(
|
|
|
15545
15394
|
if (positionChanged && isSelected && (wasJustModified || isBeingTransformed)) {
|
|
15546
15395
|
positionChanged = false;
|
|
15547
15396
|
}
|
|
15548
|
-
const resolvedSizeForCompare =
|
|
15397
|
+
const resolvedSizeForCompare = (pageChildren == null ? void 0 : pageChildren.length) ? getNodeBounds(element, pageChildren) : { width: typeof element.width === "number" ? element.width : 0, height: typeof element.height === "number" ? element.height : 0 };
|
|
15549
15398
|
const fabricText = existingObj.text ?? "";
|
|
15550
15399
|
const storeText = element.text ?? "";
|
|
15551
15400
|
const otherPropsChanged = Math.abs((existingObj.width ?? 0) - resolvedSizeForCompare.width) > 0.1 || Math.abs((existingObj.height ?? 0) - resolvedSizeForCompare.height) > 0.1 || Math.abs((existingObj.angle ?? 0) - (element.angle ?? 0)) > 0.1 || Math.abs((existingObj.scaleX ?? 1) - (element.scaleX ?? 1)) > 0.01 || Math.abs((existingObj.scaleY ?? 1) - (element.scaleY ?? 1)) > 0.01 || (existingObj.flipX ?? false) !== (element.flipX ?? false) || (existingObj.flipY ?? false) !== (element.flipY ?? false) || fabricText !== storeText || existingObj.fill !== (element.fill ?? "") || existingObj.stroke !== (element.stroke ?? "") || Math.abs((existingObj.strokeWidth ?? 0) - (element.strokeWidth ?? 0)) > 0.01 || Math.abs((existingObj.opacity ?? 1) - (element.opacity ?? 1)) > 0.01 || (existingObj.fontSize ?? 0) !== (element.fontSize ?? 0) || (existingObj.fontFamily ?? "") !== (element.fontFamily ?? "") || // Vertical alignment & min box height: panel-driven changes must trigger a re-apply
|
|
@@ -15589,28 +15438,8 @@ const PageCanvas = forwardRef(
|
|
|
15589
15438
|
});
|
|
15590
15439
|
previousVisibilityRef.current.set(element.id, currentVisible);
|
|
15591
15440
|
} else {
|
|
15592
|
-
const skipPositionBecauseSelection =
|
|
15441
|
+
const skipPositionBecauseSelection = isSelected && (deltaX > 0.1 || deltaY > 0.1) && (wasJustModified || isBeingTransformed);
|
|
15593
15442
|
const anyChange = positionChanged || otherPropsChanged || forceApplyFromPanel;
|
|
15594
|
-
if (shouldLogGroupMove() && (preserveSelectionMemberPosition || (deltaX > 0.1 || deltaY > 0.1))) {
|
|
15595
|
-
console.log("[GRP-MOVE] doSync-member", {
|
|
15596
|
-
id: element.id,
|
|
15597
|
-
type: element.type,
|
|
15598
|
-
fabric: { left: fabricLeft, top: fabricTop },
|
|
15599
|
-
store: { left: storeLeft, top: storeTop },
|
|
15600
|
-
delta: { x: deltaX, y: deltaY },
|
|
15601
|
-
flags: {
|
|
15602
|
-
preserveSelectionMemberPosition,
|
|
15603
|
-
isSelected,
|
|
15604
|
-
wasJustModified,
|
|
15605
|
-
isBeingTransformed,
|
|
15606
|
-
positionChanged,
|
|
15607
|
-
otherPropsChanged,
|
|
15608
|
-
skipPositionBecauseSelection,
|
|
15609
|
-
anyChange,
|
|
15610
|
-
syncTriggeredByPanel: syncTriggeredByPanelRef.current
|
|
15611
|
-
}
|
|
15612
|
-
});
|
|
15613
|
-
}
|
|
15614
15443
|
if (!visibilityUpdateInProgressRef.current) {
|
|
15615
15444
|
if (anyChange && !skipPositionBecauseSelection) {
|
|
15616
15445
|
updateFabricObject(existingObj, element, wasJustModified);
|
|
@@ -15706,7 +15535,7 @@ const PageCanvas = forwardRef(
|
|
|
15706
15535
|
fc.add(placeholder);
|
|
15707
15536
|
fc.bringObjectToFront(placeholder);
|
|
15708
15537
|
const activeObj = fc.getActiveObject();
|
|
15709
|
-
if (activeObj && (((
|
|
15538
|
+
if (activeObj && (((_h = activeObj._ct) == null ? void 0 : _h.isCropGroup) || activeObj.__cropGroup)) {
|
|
15710
15539
|
fc.setActiveObject(activeObj);
|
|
15711
15540
|
}
|
|
15712
15541
|
placeholder.dirty = true;
|
|
@@ -15746,7 +15575,7 @@ const PageCanvas = forwardRef(
|
|
|
15746
15575
|
fc.add(obj);
|
|
15747
15576
|
fc.bringObjectToFront(obj);
|
|
15748
15577
|
const activeObj = fc.getActiveObject();
|
|
15749
|
-
if (activeObj && (((
|
|
15578
|
+
if (activeObj && (((_i = activeObj._ct) == null ? void 0 : _i.isCropGroup) || activeObj.__cropGroup)) {
|
|
15750
15579
|
fc.setActiveObject(activeObj);
|
|
15751
15580
|
}
|
|
15752
15581
|
obj.dirty = true;
|
|
@@ -15776,20 +15605,10 @@ const PageCanvas = forwardRef(
|
|
|
15776
15605
|
});
|
|
15777
15606
|
allFabricObjects.forEach((obj) => fc.bringObjectToFront(obj));
|
|
15778
15607
|
}
|
|
15779
|
-
const activeAfterObjectSync = fc.getActiveObject();
|
|
15780
|
-
if (activeAfterObjectSync instanceof fabric.ActiveSelection) {
|
|
15781
|
-
const groupSelectionId = activeAfterObjectSync.__pixldocsGroupSelection;
|
|
15782
|
-
if (groupSelectionId) {
|
|
15783
|
-
applyLogicalGroupSelectionVisualState(activeAfterObjectSync, groupSelectionId);
|
|
15784
|
-
if (!activeAfterObjectSync.getObjects().every((obj) => !(obj instanceof fabric.Group))) {
|
|
15785
|
-
activeAfterObjectSync.setCoords();
|
|
15786
|
-
}
|
|
15787
|
-
}
|
|
15788
|
-
}
|
|
15789
15608
|
isRebuildingRef.current = false;
|
|
15790
15609
|
fc.requestRenderAll();
|
|
15791
15610
|
if (activeBeforeSync && fc.getObjects().includes(activeBeforeSync)) {
|
|
15792
|
-
const isCropGroup2 = ((
|
|
15611
|
+
const isCropGroup2 = ((_j = activeBeforeSync._ct) == null ? void 0 : _j.isCropGroup) || activeBeforeSync.__cropGroup;
|
|
15793
15612
|
if (isCropGroup2) {
|
|
15794
15613
|
fc.setActiveObject(activeBeforeSync);
|
|
15795
15614
|
fc.requestRenderAll();
|
|
@@ -15842,9 +15661,7 @@ const PageCanvas = forwardRef(
|
|
|
15842
15661
|
applyLogicalGroupSelectionVisualState(newSel, activeSelectionSnapshot.groupSelectionId);
|
|
15843
15662
|
}
|
|
15844
15663
|
fc.setActiveObject(newSel);
|
|
15845
|
-
|
|
15846
|
-
newSel.setCoords();
|
|
15847
|
-
}
|
|
15664
|
+
newSel.setCoords();
|
|
15848
15665
|
fc.requestRenderAll();
|
|
15849
15666
|
} finally {
|
|
15850
15667
|
isSyncingSelectionToFabricRef.current = false;
|
|
@@ -15872,6 +15689,10 @@ const PageCanvas = forwardRef(
|
|
|
15872
15689
|
}
|
|
15873
15690
|
}
|
|
15874
15691
|
}
|
|
15692
|
+
const recentGroupRestore = recentGroupSelectionRestoreRef.current;
|
|
15693
|
+
if ((recentGroupRestore == null ? void 0 : recentGroupRestore.groupSelectionId) && recentGroupRestore.expiresAt > Date.now()) {
|
|
15694
|
+
restoreGroupSelectionSnapshot(recentGroupRestore);
|
|
15695
|
+
}
|
|
15875
15696
|
preserveSelectionAfterTransformIdRef.current = null;
|
|
15876
15697
|
preserveActiveSelectionAfterTransformRef.current = null;
|
|
15877
15698
|
syncTriggeredByPanelRef.current = false;
|
|
@@ -16148,6 +15969,7 @@ const PageCanvas = forwardRef(
|
|
|
16148
15969
|
});
|
|
16149
15970
|
if (isPureSingleGroupSelection) {
|
|
16150
15971
|
active.hasBorders = true;
|
|
15972
|
+
active.setCoords();
|
|
16151
15973
|
applyWarpAwareSelectionBorders(active);
|
|
16152
15974
|
}
|
|
16153
15975
|
}
|
|
@@ -16216,7 +16038,7 @@ const PageCanvas = forwardRef(
|
|
|
16216
16038
|
if (fc && isTransforming(fc)) {
|
|
16217
16039
|
return;
|
|
16218
16040
|
}
|
|
16219
|
-
const currentPageTree = (
|
|
16041
|
+
const currentPageTree = ((pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_a2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _a2.children) ?? [];
|
|
16220
16042
|
const fabricPos = currentPageTree.length > 0 ? (() => {
|
|
16221
16043
|
const node = findNodeById(currentPageTree, element.id);
|
|
16222
16044
|
return node ? getAbsoluteBounds(node, currentPageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
@@ -17284,7 +17106,7 @@ const PageCanvas = forwardRef(
|
|
|
17284
17106
|
if (imageFit === "fill" && !needCropGroup2) {
|
|
17285
17107
|
const finalScaleX = baseScaleX * (element.scaleX ?? 1);
|
|
17286
17108
|
const finalScaleY = baseScaleY * (element.scaleY ?? 1);
|
|
17287
|
-
const pageTreeForCreate = ((
|
|
17109
|
+
const pageTreeForCreate = ((pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
|
|
17288
17110
|
const createPos = pageTreeForCreate.length > 0 ? (() => {
|
|
17289
17111
|
const node = findNodeById(pageTreeForCreate, element.id);
|
|
17290
17112
|
return node ? getAbsoluteBounds(node, pageTreeForCreate) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
@@ -17334,7 +17156,7 @@ const PageCanvas = forwardRef(
|
|
|
17334
17156
|
const needCropGroup = imageFitFinal !== "fill" || clipShapeFinal && clipShapeFinal !== "none";
|
|
17335
17157
|
let finalObject = img;
|
|
17336
17158
|
if (needCropGroup) {
|
|
17337
|
-
const pageTreeForCropResolve = ((
|
|
17159
|
+
const pageTreeForCropResolve = ((pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_i = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _i.children) ?? [];
|
|
17338
17160
|
const nodeForSize = pageTreeForCropResolve.length ? findNodeById(pageTreeForCropResolve, element.id) : null;
|
|
17339
17161
|
const w = nodeForSize && isElement(nodeForSize) ? nodeForSize.width : element.width;
|
|
17340
17162
|
const h = nodeForSize && isElement(nodeForSize) ? nodeForSize.height : element.height;
|
|
@@ -17378,7 +17200,7 @@ const PageCanvas = forwardRef(
|
|
|
17378
17200
|
}
|
|
17379
17201
|
const isDynamicField = dynamicFieldIds.includes(element.id);
|
|
17380
17202
|
const canBeEvented = isEditorMode || isPreviewMode && isDynamicField;
|
|
17381
|
-
const pageTreeForCrop = ((
|
|
17203
|
+
const pageTreeForCrop = ((pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_n = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _n.children) ?? [];
|
|
17382
17204
|
const createPosForCrop = pageTreeForCrop.length > 0 ? (() => {
|
|
17383
17205
|
const node = findNodeById(pageTreeForCrop, element.id);
|
|
17384
17206
|
return node ? getAbsoluteBounds(node, pageTreeForCrop) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
@@ -23794,9 +23616,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23794
23616
|
}
|
|
23795
23617
|
return svgString;
|
|
23796
23618
|
}
|
|
23797
|
-
const resolvedPackageVersion = "0.5.
|
|
23619
|
+
const resolvedPackageVersion = "0.5.286";
|
|
23798
23620
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23799
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23621
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.286";
|
|
23800
23622
|
const roundParityValue = (value) => {
|
|
23801
23623
|
if (typeof value !== "number") return value;
|
|
23802
23624
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24610,7 +24432,7 @@ class PixldocsRenderer {
|
|
|
24610
24432
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24611
24433
|
}
|
|
24612
24434
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24613
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24435
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-wObaRY6z.js");
|
|
24614
24436
|
const prepared = preparePagesForExport(
|
|
24615
24437
|
cloned.pages,
|
|
24616
24438
|
canvasWidth,
|
|
@@ -26930,7 +26752,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26930
26752
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26931
26753
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26932
26754
|
try {
|
|
26933
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
26755
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-wObaRY6z.js");
|
|
26934
26756
|
try {
|
|
26935
26757
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26936
26758
|
} catch {
|
|
@@ -27330,4 +27152,4 @@ export {
|
|
|
27330
27152
|
buildTeaserBlurFlatKeys as y,
|
|
27331
27153
|
collectFontDescriptorsFromConfig as z
|
|
27332
27154
|
};
|
|
27333
|
-
//# sourceMappingURL=index-
|
|
27155
|
+
//# sourceMappingURL=index-EkY5XEkR.js.map
|