@pixldocs/canvas-renderer 0.5.277 → 0.5.278

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.
@@ -13903,14 +13903,24 @@ const PageCanvas = forwardRef(
13903
13903
  }
13904
13904
  });
13905
13905
  let cropGroupSaveTimer = null;
13906
+ let objectModifiedInFlight = false;
13906
13907
  fabricCanvas.on("object:modified", (e) => {
13907
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
13908
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
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;
13908
13918
  try {
13909
13919
  dragStarted = false;
13910
13920
  if (shouldLogGroupMove()) {
13911
13921
  const t = e.target;
13912
13922
  console.log("[GRP-MOVE] object:modified fired", {
13913
- targetType: (_a2 = t == null ? void 0 : t.constructor) == null ? void 0 : _a2.name,
13923
+ targetType: (_c = t == null ? void 0 : t.constructor) == null ? void 0 : _c.name,
13914
13924
  isActiveSelection: t instanceof fabric.ActiveSelection,
13915
13925
  groupSelectionId: t ? t.__pixldocsGroupSelection : null,
13916
13926
  memberIds: t instanceof fabric.ActiveSelection ? t.getObjects().map((o) => getObjectId(o)) : [getObjectId(t)],
@@ -13962,7 +13972,7 @@ const PageCanvas = forwardRef(
13962
13972
  const active = fabricCanvas.getActiveObject();
13963
13973
  const activeId = active ? getObjectId(active) : null;
13964
13974
  if (active && activeId && activeId !== "__background__" && !(active instanceof fabric.Group)) {
13965
- const pageChildrenForParent = ((_b2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _b2.children) ?? [];
13975
+ const pageChildrenForParent = ((_d = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
13966
13976
  const parentGroup = findParentGroup(pageChildrenForParent, activeId);
13967
13977
  if (parentGroup && isGroup(parentGroup) && parentGroup.backgroundColor) {
13968
13978
  let fabricSectionGroup = active.group && active.group instanceof fabric.Group ? active.group : null;
@@ -14044,7 +14054,7 @@ const PageCanvas = forwardRef(
14044
14054
  useEditorStore.getState().reflowStackGroupInPage(pageId, groupId);
14045
14055
  }
14046
14056
  const stateAfter = useEditorStore.getState();
14047
- const pageAfter = ((_c = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14057
+ const pageAfter = ((_e = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
14048
14058
  const groupNodeAfter = findNodeById(pageAfter, groupId);
14049
14059
  if (groupNodeAfter) {
14050
14060
  const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
@@ -14106,7 +14116,7 @@ const PageCanvas = forwardRef(
14106
14116
  }
14107
14117
  if (active && active instanceof fabric.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
14108
14118
  const groupId = getObjectId(active);
14109
- const pageChildrenSec = ((_d = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
14119
+ const pageChildrenSec = ((_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
14110
14120
  const modifiedTarget2 = e == null ? void 0 : e.target;
14111
14121
  const resizeScaleTarget = lastResizeScaleTargetRef.current;
14112
14122
  lastResizeScaleTargetRef.current = null;
@@ -14137,7 +14147,7 @@ const PageCanvas = forwardRef(
14137
14147
  const node = findNodeById(pageChildrenSec, groupId);
14138
14148
  if (isChildModified && node && !groupMoved) {
14139
14149
  const stateAfter = useEditorStore.getState();
14140
- const pageAfter = ((_e = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
14150
+ const pageAfter = ((_g = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _g.children) ?? [];
14141
14151
  const groupNodeAfter = findNodeById(pageAfter, groupId);
14142
14152
  if (groupNodeAfter) {
14143
14153
  const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
@@ -14153,7 +14163,7 @@ const PageCanvas = forwardRef(
14153
14163
  }
14154
14164
  if (active && active instanceof fabric.Group && !(active instanceof fabric.ActiveSelection) && getObjectId(active)) {
14155
14165
  const groupId = getObjectId(active);
14156
- const pageChildren3 = ((_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
14166
+ const pageChildren3 = ((_h = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _h.children) ?? [];
14157
14167
  const w = (active.width ?? 0) * (active.scaleX ?? 1);
14158
14168
  const h = (active.height ?? 0) * (active.scaleY ?? 1);
14159
14169
  const centerX = active.left ?? 0;
@@ -14175,7 +14185,7 @@ const PageCanvas = forwardRef(
14175
14185
  }
14176
14186
  const activeObj = fabricCanvas.getActiveObject();
14177
14187
  let activeObjects = fabricCanvas.getActiveObjects();
14178
- const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_g = activeSelectionMoveStartRef.current) == null ? void 0 : _g.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
14188
+ const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_i = activeSelectionMoveStartRef.current) == null ? void 0 : _i.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
14179
14189
  const activeSelectionDelta = activeObj instanceof fabric.ActiveSelection && activeSelectionMoveStart ? (() => {
14180
14190
  const rect = activeObj.getBoundingRect();
14181
14191
  return {
@@ -14375,7 +14385,7 @@ const PageCanvas = forwardRef(
14375
14385
  }
14376
14386
  } catch {
14377
14387
  }
14378
- const pageAfterMove = ((_h = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _h.children) ?? [];
14388
+ const pageAfterMove = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
14379
14389
  const groupAfterMove = findNodeById(pageAfterMove, groupToMove.id);
14380
14390
  const memberIdsAfterMove = groupAfterMove && isGroup(groupAfterMove) ? getAllElementIds(groupAfterMove.children ?? []) : targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
14381
14391
  preservedGroupMemberIds = memberIdsAfterMove;
@@ -14690,7 +14700,7 @@ const PageCanvas = forwardRef(
14690
14700
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
14691
14701
  obj.setCoords();
14692
14702
  }
14693
- const pageChildrenForReflow = ((_i = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _i.children) ?? [];
14703
+ const pageChildrenForReflow = ((_k = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _k.children) ?? [];
14694
14704
  const stackGroupsToReflow = /* @__PURE__ */ new Set();
14695
14705
  for (const id of modifiedIdsThisRound) {
14696
14706
  const parent = findParentGroup(pageChildrenForReflow, id);
@@ -14759,6 +14769,8 @@ const PageCanvas = forwardRef(
14759
14769
  } catch (e2) {
14760
14770
  lastResizeScaleCornerRef.current = null;
14761
14771
  unlockEditsSoon();
14772
+ } finally {
14773
+ objectModifiedInFlight = false;
14762
14774
  }
14763
14775
  });
14764
14776
  fabricCanvas.on("before:selection:cleared", (e) => {
@@ -23851,9 +23863,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23851
23863
  }
23852
23864
  return svgString;
23853
23865
  }
23854
- const resolvedPackageVersion = "0.5.277";
23866
+ const resolvedPackageVersion = "0.5.278";
23855
23867
  const PACKAGE_VERSION = resolvedPackageVersion;
23856
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.277";
23868
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.278";
23857
23869
  const roundParityValue = (value) => {
23858
23870
  if (typeof value !== "number") return value;
23859
23871
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24667,7 +24679,7 @@ class PixldocsRenderer {
24667
24679
  await this.waitForCanvasScene(container, cloned, i);
24668
24680
  }
24669
24681
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24670
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CateNrsD.js");
24682
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DZihV42S.js");
24671
24683
  const prepared = preparePagesForExport(
24672
24684
  cloned.pages,
24673
24685
  canvasWidth,
@@ -26987,7 +26999,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26987
26999
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26988
27000
  sanitizeSvgTreeForPdf(svgToDraw);
26989
27001
  try {
26990
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CateNrsD.js");
27002
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DZihV42S.js");
26991
27003
  try {
26992
27004
  await logTextMeasurementDiagnostic(svgToDraw);
26993
27005
  } catch {
@@ -27387,4 +27399,4 @@ export {
27387
27399
  buildTeaserBlurFlatKeys as y,
27388
27400
  collectFontDescriptorsFromConfig as z
27389
27401
  };
27390
- //# sourceMappingURL=index-uuizjIPx.js.map
27402
+ //# sourceMappingURL=index-Cui21a0a.js.map