@pixldocs/canvas-renderer 0.5.281 → 0.5.283
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-m0_zL8dr.cjs → index-A4ICnK--.cjs} +35 -55
- package/dist/index-A4ICnK--.cjs.map +1 -0
- package/dist/{index-CcnLc5LI.js → index-DZrJdP7E.js} +35 -55
- package/dist/index-DZrJdP7E.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CyvVvmOr.cjs → vectorPdfExport-48Xfutfv.cjs} +4 -4
- package/dist/{vectorPdfExport-CyvVvmOr.cjs.map → vectorPdfExport-48Xfutfv.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CT_DagYd.js → vectorPdfExport-DwiSa6HT.js} +4 -4
- package/dist/{vectorPdfExport-CT_DagYd.js.map → vectorPdfExport-DwiSa6HT.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CcnLc5LI.js.map +0 -1
- package/dist/index-m0_zL8dr.cjs.map +0 -1
|
@@ -13905,7 +13905,7 @@ const PageCanvas = forwardRef(
|
|
|
13905
13905
|
let cropGroupSaveTimer = null;
|
|
13906
13906
|
let objectModifiedInFlight = false;
|
|
13907
13907
|
fabricCanvas.on("object:modified", (e) => {
|
|
13908
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j
|
|
13908
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
13909
13909
|
if (objectModifiedInFlight) {
|
|
13910
13910
|
if (shouldLogGroupMove()) {
|
|
13911
13911
|
console.log("[GRP-MOVE] object:modified re-entry skipped", {
|
|
@@ -14298,10 +14298,7 @@ const PageCanvas = forwardRef(
|
|
|
14298
14298
|
const groupAbs = getAbsoluteBounds(groupToMove, pageChildren2);
|
|
14299
14299
|
let movedGroupLeft = groupAbs.left;
|
|
14300
14300
|
let movedGroupTop = groupAbs.top;
|
|
14301
|
-
if (activeObj instanceof fabric.ActiveSelection &&
|
|
14302
|
-
movedGroupLeft = groupAbs.left + activeSelectionDelta.x;
|
|
14303
|
-
movedGroupTop = groupAbs.top + activeSelectionDelta.y;
|
|
14304
|
-
} else if (activeObj instanceof fabric.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
|
|
14301
|
+
if (activeObj instanceof fabric.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
|
|
14305
14302
|
const selectionRect = activeObj.getBoundingRect();
|
|
14306
14303
|
movedGroupLeft = transformStart.groupLeft + (selectionRect.left - transformStart.selectionLeft);
|
|
14307
14304
|
movedGroupTop = transformStart.groupTop + (selectionRect.top - transformStart.selectionTop);
|
|
@@ -14371,22 +14368,29 @@ const PageCanvas = forwardRef(
|
|
|
14371
14368
|
setDrilledGroupBounds(null);
|
|
14372
14369
|
drilledGroupIdRef.current = null;
|
|
14373
14370
|
const groupSelectionId = (isActiveSelection && activeObj instanceof fabric.ActiveSelection ? activeObj.__pixldocsGroupSelection : void 0) ?? groupToMove.id;
|
|
14374
|
-
const
|
|
14375
|
-
|
|
14376
|
-
const preservedGroupMemberIds = groupAfterMove && isGroup(groupAfterMove) ? getAllElementIds(groupAfterMove.children ?? []) : selectedElementIds;
|
|
14377
|
-
if (activeObj instanceof fabric.ActiveSelection) {
|
|
14371
|
+
const targetObjects = isActiveSelection && activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects() : activeObjects;
|
|
14372
|
+
if (groupSelectionId && activeObj instanceof fabric.ActiveSelection) {
|
|
14378
14373
|
restoreGroupSelectionVisualState(activeObj, groupSelectionId);
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
groupSelectionId,
|
|
14382
|
-
expiresAt: Date.now() + 1200
|
|
14383
|
-
};
|
|
14374
|
+
fabricCanvas.setActiveObject(activeObj);
|
|
14375
|
+
activeObj.setCoords();
|
|
14384
14376
|
}
|
|
14385
14377
|
selectElements([groupSelectionId], false, false);
|
|
14386
14378
|
fabricCanvas.requestRenderAll();
|
|
14387
14379
|
elementsRef.current = getCurrentElements();
|
|
14380
|
+
for (const obj of targetObjects) {
|
|
14381
|
+
const objId = getObjectId(obj);
|
|
14382
|
+
if (objId && objId !== "__background__") {
|
|
14383
|
+
justModifiedIdsRef.current.add(objId);
|
|
14384
|
+
modifiedIdsThisRound.add(objId);
|
|
14385
|
+
}
|
|
14386
|
+
}
|
|
14387
|
+
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14388
14388
|
groupSelectionTransformStartRef.current = null;
|
|
14389
14389
|
activeSelectionMoveStartRef.current = null;
|
|
14390
|
+
restorePreservedGroupSelectionSoon({
|
|
14391
|
+
memberIds: targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__"),
|
|
14392
|
+
groupSelectionId
|
|
14393
|
+
});
|
|
14390
14394
|
unlockEditsSoon();
|
|
14391
14395
|
return;
|
|
14392
14396
|
}
|
|
@@ -14648,7 +14652,7 @@ const PageCanvas = forwardRef(
|
|
|
14648
14652
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
14649
14653
|
obj.setCoords();
|
|
14650
14654
|
}
|
|
14651
|
-
const pageChildrenForReflow = ((
|
|
14655
|
+
const pageChildrenForReflow = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
|
|
14652
14656
|
const stackGroupsToReflow = /* @__PURE__ */ new Set();
|
|
14653
14657
|
for (const id of modifiedIdsThisRound) {
|
|
14654
14658
|
const parent = findParentGroup(pageChildrenForReflow, id);
|
|
@@ -15015,23 +15019,6 @@ const PageCanvas = forwardRef(
|
|
|
15015
15019
|
fc.discardActiveObject();
|
|
15016
15020
|
}
|
|
15017
15021
|
}
|
|
15018
|
-
const forceLogicalGroupStorePositionSyncIds = /* @__PURE__ */ new Set();
|
|
15019
|
-
const needsLooseLogicalGroupPositionSync = !!((activeSelectionSnapshot == null ? void 0 : activeSelectionSnapshot.groupSelectionId) && !syncTriggeredByPanelRef.current && !shouldSkipUpdates2 && !isTransforming2 && activeSelectionSnapshot.memberIds.some((id) => justModifiedIdsRef.current.has(id)));
|
|
15020
|
-
if (needsLooseLogicalGroupPositionSync) {
|
|
15021
|
-
activeSelectionSnapshot.memberIds.forEach((id) => forceLogicalGroupStorePositionSyncIds.add(id));
|
|
15022
|
-
const activeForLooseSync = fc.getActiveObject();
|
|
15023
|
-
if (activeForLooseSync instanceof fabric.ActiveSelection && activeForLooseSync.__pixldocsGroupSelection === activeSelectionSnapshot.groupSelectionId) {
|
|
15024
|
-
try {
|
|
15025
|
-
skipSelectionClearOnDiscardRef.current = true;
|
|
15026
|
-
skipActiveSelectionBakeOnClearRef.current = true;
|
|
15027
|
-
fc.discardActiveObject();
|
|
15028
|
-
} finally {
|
|
15029
|
-
skipActiveSelectionBakeOnClearRef.current = false;
|
|
15030
|
-
skipSelectionClearOnDiscardRef.current = false;
|
|
15031
|
-
}
|
|
15032
|
-
}
|
|
15033
|
-
activeSelectionSnapshot.memberIds.forEach((id) => justModifiedIdsRef.current.delete(id));
|
|
15034
|
-
}
|
|
15035
15022
|
const currentFabricObjects = /* @__PURE__ */ new Map();
|
|
15036
15023
|
fc.getObjects().forEach((obj) => {
|
|
15037
15024
|
const id = getObjectId(obj);
|
|
@@ -15045,8 +15032,7 @@ const PageCanvas = forwardRef(
|
|
|
15045
15032
|
const replacementById = !activeStillOnCanvas && activeId ? fc.getObjects().find((o) => getObjectId(o) === activeId) ?? null : null;
|
|
15046
15033
|
const restoreTarget = activeStillOnCanvas ? activeBeforeSync : replacementById;
|
|
15047
15034
|
const isActiveTextBeingEdited = activeId && editingTextIdRef.current === activeId && activeBeforeSync instanceof fabric.Textbox;
|
|
15048
|
-
|
|
15049
|
-
if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync && !keepLiveLogicalActiveSelection) {
|
|
15035
|
+
if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2) {
|
|
15050
15036
|
const freshMembers = activeSelectionSnapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
|
|
15051
15037
|
if (freshMembers.length > 1) {
|
|
15052
15038
|
isSyncingSelectionToFabricRef.current = true;
|
|
@@ -15056,9 +15042,7 @@ const PageCanvas = forwardRef(
|
|
|
15056
15042
|
applyLogicalGroupSelectionVisualState(newSel, activeSelectionSnapshot.groupSelectionId);
|
|
15057
15043
|
}
|
|
15058
15044
|
fc.setActiveObject(newSel);
|
|
15059
|
-
|
|
15060
|
-
newSel.setCoords();
|
|
15061
|
-
}
|
|
15045
|
+
newSel.setCoords();
|
|
15062
15046
|
fc.requestRenderAll();
|
|
15063
15047
|
} finally {
|
|
15064
15048
|
isSyncingSelectionToFabricRef.current = false;
|
|
@@ -15473,8 +15457,7 @@ const PageCanvas = forwardRef(
|
|
|
15473
15457
|
continue;
|
|
15474
15458
|
}
|
|
15475
15459
|
if (existingObj instanceof fabric.Group && existingObj.__cropGroup) {
|
|
15476
|
-
|
|
15477
|
-
updateFabricObject(existingObj, element, wasJustModified && !forceStorePositionSync2);
|
|
15460
|
+
updateFabricObject(existingObj, element, wasJustModified);
|
|
15478
15461
|
existingObj.set({
|
|
15479
15462
|
flipX: element.flipX ?? false,
|
|
15480
15463
|
flipY: element.flipY ?? false,
|
|
@@ -15485,7 +15468,7 @@ const PageCanvas = forwardRef(
|
|
|
15485
15468
|
if (wasJustModified) justModifiedIdsRef.current.delete(element.id);
|
|
15486
15469
|
continue;
|
|
15487
15470
|
}
|
|
15488
|
-
if (existingObj instanceof fabric.Textbox && wasJustModified && !syncTriggeredByPanelRef.current
|
|
15471
|
+
if (existingObj instanceof fabric.Textbox && wasJustModified && !syncTriggeredByPanelRef.current) {
|
|
15489
15472
|
justModifiedIdsRef.current.delete(element.id);
|
|
15490
15473
|
continue;
|
|
15491
15474
|
}
|
|
@@ -15504,8 +15487,7 @@ const PageCanvas = forwardRef(
|
|
|
15504
15487
|
return node ? getAbsoluteBounds(node, pageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15505
15488
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15506
15489
|
const comparePosForImg = getObjectSyncComparePosition(existingObj);
|
|
15507
|
-
const
|
|
15508
|
-
const preserveSelectionMemberPosition = !forceStorePositionSync && shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15490
|
+
const preserveSelectionMemberPosition = shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15509
15491
|
const positionChanged = !preserveSelectionMemberPosition && (Math.abs(comparePosForImg.left - storePosForImg.left) > 0.1 || Math.abs(comparePosForImg.top - storePosForImg.top) > 0.1);
|
|
15510
15492
|
if (visibilityChanged && !positionChanged || visibilityUpdateInProgressRef.current) {
|
|
15511
15493
|
const isDynamicField = dynamicFieldIds.includes(element.id);
|
|
@@ -15521,7 +15503,7 @@ const PageCanvas = forwardRef(
|
|
|
15521
15503
|
previousVisibilityRef.current.set(element.id, currentVisible);
|
|
15522
15504
|
} else {
|
|
15523
15505
|
if (!visibilityUpdateInProgressRef.current) {
|
|
15524
|
-
updateFabricObject(existingObj, element, wasJustModified
|
|
15506
|
+
updateFabricObject(existingObj, element, wasJustModified || preserveSelectionMemberPosition);
|
|
15525
15507
|
}
|
|
15526
15508
|
const isDynamicField = dynamicFieldIds.includes(element.id);
|
|
15527
15509
|
const canBeEvented = isEditorMode || isPreviewMode && isDynamicField;
|
|
@@ -15554,14 +15536,13 @@ const PageCanvas = forwardRef(
|
|
|
15554
15536
|
const storeTop = storePos.top;
|
|
15555
15537
|
const deltaX = Math.abs(fabricLeft - storeLeft);
|
|
15556
15538
|
const deltaY = Math.abs(fabricTop - storeTop);
|
|
15557
|
-
const
|
|
15558
|
-
const preserveSelectionMemberPosition = !forceStorePositionSync && shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15539
|
+
const preserveSelectionMemberPosition = shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15559
15540
|
let positionChanged = !preserveSelectionMemberPosition && (deltaX > 0.1 || deltaY > 0.1);
|
|
15560
15541
|
const activeObj = fc.getActiveObject();
|
|
15561
15542
|
const isInActiveSelection = activeObj && (activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects().includes(existingObj) : activeObj === existingObj);
|
|
15562
15543
|
const isInSelectedIds = selectedIdsFromStore.has(element.id);
|
|
15563
15544
|
const isSelected = isInActiveSelection || isInSelectedIds;
|
|
15564
|
-
if (positionChanged && isSelected && (wasJustModified || isBeingTransformed)
|
|
15545
|
+
if (positionChanged && isSelected && (wasJustModified || isBeingTransformed)) {
|
|
15565
15546
|
positionChanged = false;
|
|
15566
15547
|
}
|
|
15567
15548
|
const resolvedSizeForCompare = pageTree.length ? getNodeBounds(element, pageTree) : { width: typeof element.width === "number" ? element.width : 0, height: typeof element.height === "number" ? element.height : 0 };
|
|
@@ -15608,9 +15589,9 @@ const PageCanvas = forwardRef(
|
|
|
15608
15589
|
});
|
|
15609
15590
|
previousVisibilityRef.current.set(element.id, currentVisible);
|
|
15610
15591
|
} else {
|
|
15611
|
-
const skipPositionBecauseSelection = preserveSelectionMemberPosition ||
|
|
15592
|
+
const skipPositionBecauseSelection = preserveSelectionMemberPosition || isSelected && (deltaX > 0.1 || deltaY > 0.1) && (wasJustModified || isBeingTransformed);
|
|
15612
15593
|
const anyChange = positionChanged || otherPropsChanged || forceApplyFromPanel;
|
|
15613
|
-
if (shouldLogGroupMove() && (
|
|
15594
|
+
if (shouldLogGroupMove() && (preserveSelectionMemberPosition || (deltaX > 0.1 || deltaY > 0.1))) {
|
|
15614
15595
|
console.log("[GRP-MOVE] doSync-member", {
|
|
15615
15596
|
id: element.id,
|
|
15616
15597
|
type: element.type,
|
|
@@ -15618,7 +15599,6 @@ const PageCanvas = forwardRef(
|
|
|
15618
15599
|
store: { left: storeLeft, top: storeTop },
|
|
15619
15600
|
delta: { x: deltaX, y: deltaY },
|
|
15620
15601
|
flags: {
|
|
15621
|
-
forceStorePositionSync,
|
|
15622
15602
|
preserveSelectionMemberPosition,
|
|
15623
15603
|
isSelected,
|
|
15624
15604
|
wasJustModified,
|
|
@@ -15633,7 +15613,7 @@ const PageCanvas = forwardRef(
|
|
|
15633
15613
|
}
|
|
15634
15614
|
if (!visibilityUpdateInProgressRef.current) {
|
|
15635
15615
|
if (anyChange && !skipPositionBecauseSelection) {
|
|
15636
|
-
updateFabricObject(existingObj, element, wasJustModified
|
|
15616
|
+
updateFabricObject(existingObj, element, wasJustModified);
|
|
15637
15617
|
if (wasJustModified) justModifiedIdsRef.current.delete(element.id);
|
|
15638
15618
|
} else if (skipPositionBecauseSelection && anyChange) {
|
|
15639
15619
|
const savedLeft = existingObj.left;
|
|
@@ -23812,9 +23792,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23812
23792
|
}
|
|
23813
23793
|
return svgString;
|
|
23814
23794
|
}
|
|
23815
|
-
const resolvedPackageVersion = "0.5.
|
|
23795
|
+
const resolvedPackageVersion = "0.5.283";
|
|
23816
23796
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23817
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23797
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.283";
|
|
23818
23798
|
const roundParityValue = (value) => {
|
|
23819
23799
|
if (typeof value !== "number") return value;
|
|
23820
23800
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24628,7 +24608,7 @@ class PixldocsRenderer {
|
|
|
24628
24608
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24629
24609
|
}
|
|
24630
24610
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24631
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24611
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DwiSa6HT.js");
|
|
24632
24612
|
const prepared = preparePagesForExport(
|
|
24633
24613
|
cloned.pages,
|
|
24634
24614
|
canvasWidth,
|
|
@@ -26948,7 +26928,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26948
26928
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26949
26929
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26950
26930
|
try {
|
|
26951
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
26931
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DwiSa6HT.js");
|
|
26952
26932
|
try {
|
|
26953
26933
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26954
26934
|
} catch {
|
|
@@ -27348,4 +27328,4 @@ export {
|
|
|
27348
27328
|
buildTeaserBlurFlatKeys as y,
|
|
27349
27329
|
collectFontDescriptorsFromConfig as z
|
|
27350
27330
|
};
|
|
27351
|
-
//# sourceMappingURL=index-
|
|
27331
|
+
//# sourceMappingURL=index-DZrJdP7E.js.map
|