@pixldocs/canvas-renderer 0.5.268 → 0.5.270
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-DNGRsx4X.cjs → index-CLq3CdA3.cjs} +81 -47
- package/dist/index-CLq3CdA3.cjs.map +1 -0
- package/dist/{index-D4jC3E0x.js → index-RDXGR8QW.js} +81 -47
- package/dist/index-RDXGR8QW.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CO7vD_-C.js → vectorPdfExport--X5puWU1.js} +4 -4
- package/dist/{vectorPdfExport-CO7vD_-C.js.map → vectorPdfExport--X5puWU1.js.map} +1 -1
- package/dist/{vectorPdfExport-D2g8-LcJ.cjs → vectorPdfExport-BpHyRyQS.cjs} +4 -4
- package/dist/{vectorPdfExport-D2g8-LcJ.cjs.map → vectorPdfExport-BpHyRyQS.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-D4jC3E0x.js.map +0 -1
- package/dist/index-DNGRsx4X.cjs.map +0 -1
|
@@ -10995,9 +10995,9 @@ const scaleUpdateNumber = (updates, source, key, factor) => {
|
|
|
10995
10995
|
const value = Number(source == null ? void 0 : source[key]);
|
|
10996
10996
|
if (Number.isFinite(value)) updates[key] = value * factor;
|
|
10997
10997
|
};
|
|
10998
|
-
const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
10999
|
-
const sx = Math.abs(obj.scaleX ?? 1) || 1;
|
|
11000
|
-
const sy = Math.abs(obj.scaleY ?? 1) || 1;
|
|
10998
|
+
const bakeTextboxScaleIntoTypography = (obj, sourceElement, scaleOverride) => {
|
|
10999
|
+
const sx = Math.abs((scaleOverride == null ? void 0 : scaleOverride.scaleX) ?? obj.scaleX ?? 1) || 1;
|
|
11000
|
+
const sy = Math.abs((scaleOverride == null ? void 0 : scaleOverride.scaleY) ?? obj.scaleY ?? 1) || 1;
|
|
11001
11001
|
if (Math.abs(sx - 1) < 1e-3 && Math.abs(sy - 1) < 1e-3) return null;
|
|
11002
11002
|
const isUniform = Math.abs(sx - sy) < 0.01;
|
|
11003
11003
|
const fontScale = isUniform ? (sx + sy) / 2 : Math.abs(sy - 1) > 1e-3 ? sy : 1;
|
|
@@ -11213,6 +11213,7 @@ const PageCanvas = forwardRef(
|
|
|
11213
11213
|
useRef(null);
|
|
11214
11214
|
const lastTextEditDimensionsRef = useRef(null);
|
|
11215
11215
|
const lastResizeScaleTargetRef = useRef(null);
|
|
11216
|
+
const lastResizeScaleCornerRef = useRef(null);
|
|
11216
11217
|
const preserveSelectionAfterTransformIdRef = useRef(null);
|
|
11217
11218
|
const groupSelectionTransformStartRef = useRef(null);
|
|
11218
11219
|
const activeSelectionMoveStartRef = useRef(null);
|
|
@@ -11540,6 +11541,7 @@ const PageCanvas = forwardRef(
|
|
|
11540
11541
|
fc.__isUserTransforming = true;
|
|
11541
11542
|
didTransformRef.current = true;
|
|
11542
11543
|
lastResizeScaleTargetRef.current = target;
|
|
11544
|
+
lastResizeScaleCornerRef.current = corner;
|
|
11543
11545
|
const targetId = getObjectId(target);
|
|
11544
11546
|
if (targetId && targetId !== "__background__") {
|
|
11545
11547
|
preserveSelectionAfterTransformIdRef.current = targetId;
|
|
@@ -13367,10 +13369,11 @@ const PageCanvas = forwardRef(
|
|
|
13367
13369
|
fabricCanvas.on("selection:cleared", () => {
|
|
13368
13370
|
});
|
|
13369
13371
|
fabricCanvas.on("object:scaling", (e) => {
|
|
13370
|
-
var _a2;
|
|
13372
|
+
var _a2, _b2;
|
|
13371
13373
|
if (!isActiveRef.current) return;
|
|
13372
13374
|
const t = e.target;
|
|
13373
13375
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
13376
|
+
lastResizeScaleCornerRef.current = ((_a2 = e.transform) == null ? void 0 : _a2.corner) ?? null;
|
|
13374
13377
|
prepareGroupSelectionTransformStart(t);
|
|
13375
13378
|
markTransforming(t);
|
|
13376
13379
|
didTransformRef.current = true;
|
|
@@ -13688,16 +13691,17 @@ const PageCanvas = forwardRef(
|
|
|
13688
13691
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
13689
13692
|
if (drilledGroupIdRef.current) {
|
|
13690
13693
|
try {
|
|
13691
|
-
(
|
|
13694
|
+
(_b2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _b2.call(fabricCanvas);
|
|
13692
13695
|
} catch {
|
|
13693
13696
|
}
|
|
13694
13697
|
}
|
|
13695
13698
|
});
|
|
13696
13699
|
fabricCanvas.on("object:resizing", (e) => {
|
|
13697
|
-
var _a2;
|
|
13700
|
+
var _a2, _b2;
|
|
13698
13701
|
if (!isActiveRef.current) return;
|
|
13699
13702
|
const t = e.target;
|
|
13700
13703
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
13704
|
+
lastResizeScaleCornerRef.current = ((_a2 = e.transform) == null ? void 0 : _a2.corner) ?? null;
|
|
13701
13705
|
markTransforming(t);
|
|
13702
13706
|
didTransformRef.current = true;
|
|
13703
13707
|
const transformTargetId = t ? getObjectId(t) : null;
|
|
@@ -13773,7 +13777,7 @@ const PageCanvas = forwardRef(
|
|
|
13773
13777
|
setGuides(gridGuidesForTextResize.length ? [...scaleGuides, ...gridGuidesForTextResize] : scaleGuides);
|
|
13774
13778
|
if (drilledGroupIdRef.current) {
|
|
13775
13779
|
try {
|
|
13776
|
-
(
|
|
13780
|
+
(_b2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _b2.call(fabricCanvas);
|
|
13777
13781
|
} catch {
|
|
13778
13782
|
}
|
|
13779
13783
|
}
|
|
@@ -14301,9 +14305,21 @@ const PageCanvas = forwardRef(
|
|
|
14301
14305
|
const groupSelectionId = (isActiveSelection && activeObj instanceof fabric.ActiveSelection ? activeObj.__pixldocsGroupSelection : void 0) ?? groupToMove.id;
|
|
14302
14306
|
const targetObjects = isActiveSelection && activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects() : activeObjects;
|
|
14303
14307
|
if (groupSelectionId && activeObj instanceof fabric.ActiveSelection) {
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
|
|
14308
|
+
try {
|
|
14309
|
+
skipSelectionClearOnDiscardRef.current = true;
|
|
14310
|
+
skipActiveSelectionBakeOnClearRef.current = true;
|
|
14311
|
+
try {
|
|
14312
|
+
fabricCanvas.discardActiveObject();
|
|
14313
|
+
} finally {
|
|
14314
|
+
skipActiveSelectionBakeOnClearRef.current = false;
|
|
14315
|
+
skipSelectionClearOnDiscardRef.current = false;
|
|
14316
|
+
}
|
|
14317
|
+
} catch {
|
|
14318
|
+
}
|
|
14319
|
+
const bakedSelection = targetObjects.length > 1 ? new fabric.ActiveSelection(targetObjects, { canvas: fabricCanvas }) : activeObj;
|
|
14320
|
+
restoreGroupSelectionVisualState(bakedSelection, groupSelectionId);
|
|
14321
|
+
fabricCanvas.setActiveObject(bakedSelection);
|
|
14322
|
+
bakedSelection.setCoords();
|
|
14307
14323
|
}
|
|
14308
14324
|
selectElements([groupSelectionId], false, false);
|
|
14309
14325
|
fabricCanvas.requestRenderAll();
|
|
@@ -14488,6 +14504,8 @@ const PageCanvas = forwardRef(
|
|
|
14488
14504
|
} else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
14489
14505
|
const sx = Math.abs(decomposed.scaleX || 1);
|
|
14490
14506
|
const sy = Math.abs(decomposed.scaleY || 1);
|
|
14507
|
+
const lastCorner = lastResizeScaleCornerRef.current ?? "";
|
|
14508
|
+
const isCornerGroupScale = lastCorner === "tl" || lastCorner === "tr" || lastCorner === "bl" || lastCorner === "br";
|
|
14491
14509
|
const bakedWidth = Math.max(20, intrinsicWidth * sx);
|
|
14492
14510
|
const bakedHeight = Math.max(1, intrinsicHeight * sy);
|
|
14493
14511
|
finalWidth = bakedWidth;
|
|
@@ -14495,8 +14513,13 @@ const PageCanvas = forwardRef(
|
|
|
14495
14513
|
finalScaleX = 1;
|
|
14496
14514
|
finalScaleY = 1;
|
|
14497
14515
|
try {
|
|
14498
|
-
|
|
14499
|
-
|
|
14516
|
+
if (isCornerGroupScale) {
|
|
14517
|
+
bakeTextboxScaleIntoTypography(obj, sourceElement, { scaleX: sx, scaleY: sy });
|
|
14518
|
+
} else {
|
|
14519
|
+
obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1 });
|
|
14520
|
+
obj.minBoxHeight = bakedHeight;
|
|
14521
|
+
obj.initDimensions();
|
|
14522
|
+
}
|
|
14500
14523
|
obj.setCoords();
|
|
14501
14524
|
} catch {
|
|
14502
14525
|
}
|
|
@@ -14637,10 +14660,12 @@ const PageCanvas = forwardRef(
|
|
|
14637
14660
|
}
|
|
14638
14661
|
groupSelectionTransformStartRef.current = null;
|
|
14639
14662
|
activeSelectionMoveStartRef.current = null;
|
|
14663
|
+
lastResizeScaleCornerRef.current = null;
|
|
14640
14664
|
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14641
14665
|
commitHistory();
|
|
14642
14666
|
unlockEditsSoon();
|
|
14643
14667
|
} catch (e2) {
|
|
14668
|
+
lastResizeScaleCornerRef.current = null;
|
|
14644
14669
|
unlockEditsSoon();
|
|
14645
14670
|
}
|
|
14646
14671
|
});
|
|
@@ -14899,13 +14924,14 @@ const PageCanvas = forwardRef(
|
|
|
14899
14924
|
visibilityUpdateInProgressRef.current = false;
|
|
14900
14925
|
}
|
|
14901
14926
|
doSyncRef.current = () => {
|
|
14902
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i
|
|
14927
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
14903
14928
|
const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
|
|
14904
14929
|
const state = useEditorStore.getState();
|
|
14905
|
-
const
|
|
14930
|
+
const storePage = state.canvas.pages.find((p) => p.id === pageId);
|
|
14931
|
+
const pageTree = isPreviewMode && (pageChildren == null ? void 0 : pageChildren.length) ? pageChildren ?? [] : (storePage == null ? void 0 : storePage.children) ?? [];
|
|
14932
|
+
const elementsToSync = isPreviewMode ? elements : pageTree.length ? flattenChildren(pageTree) : elements;
|
|
14906
14933
|
elementsRef.current = elementsToSync;
|
|
14907
|
-
const
|
|
14908
|
-
const selectedIdsFromStore = new Set(((_b2 = state.canvas) == null ? void 0 : _b2.selectedIds) ?? []);
|
|
14934
|
+
const selectedIdsFromStore = new Set(((_a2 = state.canvas) == null ? void 0 : _a2.selectedIds) ?? []);
|
|
14909
14935
|
isRebuildingRef.current = true;
|
|
14910
14936
|
const allElementIds = new Set(elementsToSync.map((el) => el.id));
|
|
14911
14937
|
const sectionGroups = pageTree.filter(
|
|
@@ -14933,7 +14959,7 @@ const PageCanvas = forwardRef(
|
|
|
14933
14959
|
const activeObjId = activeObj ? getObjectId(activeObj) : null;
|
|
14934
14960
|
const isTextBeingEdited = activeObjId && editingTextIdRef.current === activeObjId;
|
|
14935
14961
|
const isMultiSelect = activeObj instanceof fabric.ActiveSelection;
|
|
14936
|
-
if (activeObj && isMultiSelect && !(((
|
|
14962
|
+
if (activeObj && isMultiSelect && !(((_b2 = activeObj._ct) == null ? void 0 : _b2.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
|
|
14937
14963
|
fc.discardActiveObject();
|
|
14938
14964
|
}
|
|
14939
14965
|
}
|
|
@@ -14970,7 +14996,7 @@ const PageCanvas = forwardRef(
|
|
|
14970
14996
|
fc.requestRenderAll();
|
|
14971
14997
|
}
|
|
14972
14998
|
} else if (!skipRestoreSelection && restoreTarget && !isActiveTextBeingEdited) {
|
|
14973
|
-
const isCropGroup2 = ((
|
|
14999
|
+
const isCropGroup2 = ((_c = restoreTarget._ct) == null ? void 0 : _c.isCropGroup) || restoreTarget.__cropGroup;
|
|
14974
15000
|
const isSectionGroup = activeId && sectionGroupIds.has(activeId);
|
|
14975
15001
|
if ((isCropGroup2 || !shouldSkipUpdates2) && !isSectionGroup) {
|
|
14976
15002
|
fc.setActiveObject(restoreTarget);
|
|
@@ -15098,7 +15124,7 @@ const PageCanvas = forwardRef(
|
|
|
15098
15124
|
const sourceUrlChanged = currentUrlNormalized !== storedUrlNormalized;
|
|
15099
15125
|
const newFadeKey = edgeFadeKey(element);
|
|
15100
15126
|
const oldFadeKey = isCropGroup2 ? existingObj.__edgeFadeInputKey || "" : existingObj.__edgeFadeKey || "";
|
|
15101
|
-
const innerImg = (
|
|
15127
|
+
const innerImg = (_d = existingObj == null ? void 0 : existingObj.__cropData) == null ? void 0 : _d._img;
|
|
15102
15128
|
const innerOldKey = isCropGroup2 ? oldFadeKey : innerImg ? innerImg.__edgeFadeKey || "" : oldFadeKey;
|
|
15103
15129
|
const cropFadeRendererMissing = isCropGroup2 && Boolean(newFadeKey) && !existingObj.__edgeFadeRenderConfig;
|
|
15104
15130
|
const fadeKeyChanged = newFadeKey !== oldFadeKey || newFadeKey !== innerOldKey || cropFadeRendererMissing;
|
|
@@ -15106,14 +15132,14 @@ const PageCanvas = forwardRef(
|
|
|
15106
15132
|
const needsCropGroupFadeUpdate = isCropGroup2 && fadeKeyChanged;
|
|
15107
15133
|
const hadUrlBefore = storedImageUrl && String(storedImageUrl).trim() !== "";
|
|
15108
15134
|
if (!hasUrl && hadUrlBefore) {
|
|
15109
|
-
const resolvedSizeImg =
|
|
15135
|
+
const resolvedSizeImg = pageTree.length ? getNodeBounds(element, pageTree) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
|
|
15110
15136
|
const hasExplicitSize = typeof element.width === "number" && Number.isFinite(element.width) && element.width > 0 && typeof element.height === "number" && Number.isFinite(element.height) && element.height > 0;
|
|
15111
15137
|
const minVisiblePlaceholder = hasExplicitSize ? 1 : 20;
|
|
15112
15138
|
const nextWidth = Math.max(minVisiblePlaceholder, Number(resolvedSizeImg.width) || 200);
|
|
15113
15139
|
const nextHeight = Math.max(minVisiblePlaceholder, Number(resolvedSizeImg.height) || 50);
|
|
15114
|
-
const storePosImg =
|
|
15115
|
-
const node = findNodeById(
|
|
15116
|
-
return node ? getAbsoluteBounds(node,
|
|
15140
|
+
const storePosImg = pageTree.length ? (() => {
|
|
15141
|
+
const node = findNodeById(pageTree, element.id);
|
|
15142
|
+
return node ? getAbsoluteBounds(node, pageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15117
15143
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15118
15144
|
const elementForPlaceholder = { ...element, width: nextWidth, height: nextHeight };
|
|
15119
15145
|
const placeholder = isCropGroup2 ? createImagePlaceholderForGroup(elementForPlaceholder) : createImagePlaceholder(elementForPlaceholder);
|
|
@@ -15136,8 +15162,8 @@ const PageCanvas = forwardRef(
|
|
|
15136
15162
|
fc.requestRenderAll();
|
|
15137
15163
|
continue;
|
|
15138
15164
|
}
|
|
15139
|
-
const imageFitForReplace = element.imageFit || ((
|
|
15140
|
-
const clipShapeForReplace = element.clipShape ?? ((
|
|
15165
|
+
const imageFitForReplace = element.imageFit || ((_e = element.style) == null ? void 0 : _e.imageFit) || "cover";
|
|
15166
|
+
const clipShapeForReplace = element.clipShape ?? ((_f = element.style) == null ? void 0 : _f.imageFrameShape) ?? (isPreviewMode ? "rectangle" : "none");
|
|
15141
15167
|
const needCropGroupForElement = imageFitForReplace !== "fill" || clipShapeForReplace && clipShapeForReplace !== "none";
|
|
15142
15168
|
const plainImageNeedsCropGroup = hasUrl && !isCropGroup2 && existingObj instanceof fabric.FabricImage && needCropGroupForElement;
|
|
15143
15169
|
if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate)) {
|
|
@@ -15174,9 +15200,9 @@ const PageCanvas = forwardRef(
|
|
|
15174
15200
|
}
|
|
15175
15201
|
ct.rx = rxRatio;
|
|
15176
15202
|
}
|
|
15177
|
-
const cropPos =
|
|
15178
|
-
const node = findNodeById(
|
|
15179
|
-
return node ? getAbsoluteBounds(node,
|
|
15203
|
+
const cropPos = pageTree.length ? (() => {
|
|
15204
|
+
const node = findNodeById(pageTree, element.id);
|
|
15205
|
+
return node ? getAbsoluteBounds(node, pageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15180
15206
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15181
15207
|
const cropCenterX = cropPos.left + (ct.frameW ?? 0) / 2;
|
|
15182
15208
|
const cropCenterY = cropPos.top + (ct.frameH ?? 0) / 2;
|
|
@@ -15273,7 +15299,7 @@ const PageCanvas = forwardRef(
|
|
|
15273
15299
|
continue;
|
|
15274
15300
|
}
|
|
15275
15301
|
} else if (!hasUrl && !isPlaceholder) {
|
|
15276
|
-
const resolvedSizeImg =
|
|
15302
|
+
const resolvedSizeImg = pageTree.length ? getNodeBounds(element, pageTree) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
|
|
15277
15303
|
const hasExplicitSize = typeof element.width === "number" && Number.isFinite(element.width) && element.width > 0 && typeof element.height === "number" && Number.isFinite(element.height) && element.height > 0;
|
|
15278
15304
|
const minVisiblePlaceholder = hasExplicitSize ? 1 : 20;
|
|
15279
15305
|
const elementForPlaceholder = {
|
|
@@ -15303,11 +15329,11 @@ const PageCanvas = forwardRef(
|
|
|
15303
15329
|
placeholder.__imageSrc = void 0;
|
|
15304
15330
|
} else if (!isBeingTransformed && !isBeingTextEdited && !shouldSkipUpdates2) {
|
|
15305
15331
|
if (isPlaceholderGroup) {
|
|
15306
|
-
const storePosImg =
|
|
15307
|
-
const node = findNodeById(
|
|
15308
|
-
return node ? getAbsoluteBounds(node,
|
|
15332
|
+
const storePosImg = pageTree.length ? (() => {
|
|
15333
|
+
const node = findNodeById(pageTree, element.id);
|
|
15334
|
+
return node ? getAbsoluteBounds(node, pageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15309
15335
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15310
|
-
const resolvedSizeImg =
|
|
15336
|
+
const resolvedSizeImg = pageTree.length ? getNodeBounds(element, pageTree) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
|
|
15311
15337
|
const hasExplicitSize = typeof element.width === "number" && Number.isFinite(element.width) && element.width > 0 && typeof element.height === "number" && Number.isFinite(element.height) && element.height > 0;
|
|
15312
15338
|
const minVisiblePlaceholder = hasExplicitSize ? 1 : 20;
|
|
15313
15339
|
const nextWidth = Math.max(minVisiblePlaceholder, Number(resolvedSizeImg.width) || 200);
|
|
@@ -15367,9 +15393,9 @@ const PageCanvas = forwardRef(
|
|
|
15367
15393
|
const previousVisible = previousVisibilityRef.current.get(element.id) ?? true;
|
|
15368
15394
|
const currentVisible = element.visible !== false;
|
|
15369
15395
|
const visibilityChanged = previousVisible !== currentVisible;
|
|
15370
|
-
const storePosForImg =
|
|
15371
|
-
const node = findNodeById(
|
|
15372
|
-
return node ? getAbsoluteBounds(node,
|
|
15396
|
+
const storePosForImg = pageTree.length ? (() => {
|
|
15397
|
+
const node = findNodeById(pageTree, element.id);
|
|
15398
|
+
return node ? getAbsoluteBounds(node, pageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15373
15399
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15374
15400
|
const positionChanged = Math.abs((existingObj.left ?? 0) - storePosForImg.left) > 0.1 || Math.abs((existingObj.top ?? 0) - storePosForImg.top) > 0.1;
|
|
15375
15401
|
if (visibilityChanged && !positionChanged || visibilityUpdateInProgressRef.current) {
|
|
@@ -15567,7 +15593,7 @@ const PageCanvas = forwardRef(
|
|
|
15567
15593
|
fc.add(placeholder);
|
|
15568
15594
|
fc.bringObjectToFront(placeholder);
|
|
15569
15595
|
const activeObj = fc.getActiveObject();
|
|
15570
|
-
if (activeObj && (((
|
|
15596
|
+
if (activeObj && (((_g = activeObj._ct) == null ? void 0 : _g.isCropGroup) || activeObj.__cropGroup)) {
|
|
15571
15597
|
fc.setActiveObject(activeObj);
|
|
15572
15598
|
}
|
|
15573
15599
|
placeholder.dirty = true;
|
|
@@ -15607,7 +15633,7 @@ const PageCanvas = forwardRef(
|
|
|
15607
15633
|
fc.add(obj);
|
|
15608
15634
|
fc.bringObjectToFront(obj);
|
|
15609
15635
|
const activeObj = fc.getActiveObject();
|
|
15610
|
-
if (activeObj && (((
|
|
15636
|
+
if (activeObj && (((_h = activeObj._ct) == null ? void 0 : _h.isCropGroup) || activeObj.__cropGroup)) {
|
|
15611
15637
|
fc.setActiveObject(activeObj);
|
|
15612
15638
|
}
|
|
15613
15639
|
obj.dirty = true;
|
|
@@ -15637,10 +15663,18 @@ const PageCanvas = forwardRef(
|
|
|
15637
15663
|
});
|
|
15638
15664
|
allFabricObjects.forEach((obj) => fc.bringObjectToFront(obj));
|
|
15639
15665
|
}
|
|
15666
|
+
const activeAfterObjectSync = fc.getActiveObject();
|
|
15667
|
+
if (activeAfterObjectSync instanceof fabric.ActiveSelection) {
|
|
15668
|
+
const groupSelectionId = activeAfterObjectSync.__pixldocsGroupSelection;
|
|
15669
|
+
if (groupSelectionId) {
|
|
15670
|
+
applyLogicalGroupSelectionVisualState(activeAfterObjectSync, groupSelectionId);
|
|
15671
|
+
activeAfterObjectSync.setCoords();
|
|
15672
|
+
}
|
|
15673
|
+
}
|
|
15640
15674
|
isRebuildingRef.current = false;
|
|
15641
15675
|
fc.requestRenderAll();
|
|
15642
15676
|
if (activeBeforeSync && fc.getObjects().includes(activeBeforeSync)) {
|
|
15643
|
-
const isCropGroup2 = ((
|
|
15677
|
+
const isCropGroup2 = ((_i = activeBeforeSync._ct) == null ? void 0 : _i.isCropGroup) || activeBeforeSync.__cropGroup;
|
|
15644
15678
|
if (isCropGroup2) {
|
|
15645
15679
|
fc.setActiveObject(activeBeforeSync);
|
|
15646
15680
|
fc.requestRenderAll();
|
|
@@ -17134,7 +17168,7 @@ const PageCanvas = forwardRef(
|
|
|
17134
17168
|
if (imageFit === "fill" && !needCropGroup2) {
|
|
17135
17169
|
const finalScaleX = baseScaleX * (element.scaleX ?? 1);
|
|
17136
17170
|
const finalScaleY = baseScaleY * (element.scaleY ?? 1);
|
|
17137
|
-
const pageTreeForCreate = ((pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
|
|
17171
|
+
const pageTreeForCreate = ((isPreviewMode || isExportMode) && (pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
|
|
17138
17172
|
const createPos = pageTreeForCreate.length > 0 ? (() => {
|
|
17139
17173
|
const node = findNodeById(pageTreeForCreate, element.id);
|
|
17140
17174
|
return node ? getAbsoluteBounds(node, pageTreeForCreate) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
@@ -17184,7 +17218,7 @@ const PageCanvas = forwardRef(
|
|
|
17184
17218
|
const needCropGroup = imageFitFinal !== "fill" || clipShapeFinal && clipShapeFinal !== "none";
|
|
17185
17219
|
let finalObject = img;
|
|
17186
17220
|
if (needCropGroup) {
|
|
17187
|
-
const pageTreeForCropResolve = ((pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_i = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _i.children) ?? [];
|
|
17221
|
+
const pageTreeForCropResolve = ((isPreviewMode || isExportMode) && (pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_i = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _i.children) ?? [];
|
|
17188
17222
|
const nodeForSize = pageTreeForCropResolve.length ? findNodeById(pageTreeForCropResolve, element.id) : null;
|
|
17189
17223
|
const w = nodeForSize && isElement(nodeForSize) ? nodeForSize.width : element.width;
|
|
17190
17224
|
const h = nodeForSize && isElement(nodeForSize) ? nodeForSize.height : element.height;
|
|
@@ -17228,7 +17262,7 @@ const PageCanvas = forwardRef(
|
|
|
17228
17262
|
}
|
|
17229
17263
|
const isDynamicField = dynamicFieldIds.includes(element.id);
|
|
17230
17264
|
const canBeEvented = isEditorMode || isPreviewMode && isDynamicField;
|
|
17231
|
-
const pageTreeForCrop = ((pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_n = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _n.children) ?? [];
|
|
17265
|
+
const pageTreeForCrop = ((isPreviewMode || isExportMode) && (pageChildren == null ? void 0 : pageChildren.length) ? pageChildren : (_n = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _n.children) ?? [];
|
|
17232
17266
|
const createPosForCrop = pageTreeForCrop.length > 0 ? (() => {
|
|
17233
17267
|
const node = findNodeById(pageTreeForCrop, element.id);
|
|
17234
17268
|
return node ? getAbsoluteBounds(node, pageTreeForCrop) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
@@ -23644,9 +23678,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23644
23678
|
}
|
|
23645
23679
|
return svgString;
|
|
23646
23680
|
}
|
|
23647
|
-
const resolvedPackageVersion = "0.5.
|
|
23681
|
+
const resolvedPackageVersion = "0.5.270";
|
|
23648
23682
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23649
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23683
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.270";
|
|
23650
23684
|
const roundParityValue = (value) => {
|
|
23651
23685
|
if (typeof value !== "number") return value;
|
|
23652
23686
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24460,7 +24494,7 @@ class PixldocsRenderer {
|
|
|
24460
24494
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24461
24495
|
}
|
|
24462
24496
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24463
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport
|
|
24497
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport--X5puWU1.js");
|
|
24464
24498
|
const prepared = preparePagesForExport(
|
|
24465
24499
|
cloned.pages,
|
|
24466
24500
|
canvasWidth,
|
|
@@ -26780,7 +26814,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26780
26814
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26781
26815
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26782
26816
|
try {
|
|
26783
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport
|
|
26817
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport--X5puWU1.js");
|
|
26784
26818
|
try {
|
|
26785
26819
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26786
26820
|
} catch {
|
|
@@ -27180,4 +27214,4 @@ export {
|
|
|
27180
27214
|
buildTeaserBlurFlatKeys as y,
|
|
27181
27215
|
collectFontDescriptorsFromConfig as z
|
|
27182
27216
|
};
|
|
27183
|
-
//# sourceMappingURL=index-
|
|
27217
|
+
//# sourceMappingURL=index-RDXGR8QW.js.map
|