@pixldocs/canvas-renderer 0.5.272 → 0.5.273

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.
@@ -14986,6 +14986,22 @@ const PageCanvas = forwardRef(
14986
14986
  fc.discardActiveObject();
14987
14987
  }
14988
14988
  }
14989
+ const forceLogicalGroupStorePositionSyncIds = /* @__PURE__ */ new Set();
14990
+ const needsLooseLogicalGroupPositionSync = !!((activeSelectionSnapshot == null ? void 0 : activeSelectionSnapshot.groupSelectionId) && !syncTriggeredByPanelRef.current && !shouldSkipUpdates2 && !isTransforming2 && activeSelectionSnapshot.memberIds.some((id) => justModifiedIdsRef.current.has(id)));
14991
+ if (needsLooseLogicalGroupPositionSync) {
14992
+ activeSelectionSnapshot.memberIds.forEach((id) => forceLogicalGroupStorePositionSyncIds.add(id));
14993
+ const activeForLooseSync = fc.getActiveObject();
14994
+ if (activeForLooseSync instanceof fabric.ActiveSelection && activeForLooseSync.__pixldocsGroupSelection === activeSelectionSnapshot.groupSelectionId) {
14995
+ try {
14996
+ skipSelectionClearOnDiscardRef.current = true;
14997
+ skipActiveSelectionBakeOnClearRef.current = true;
14998
+ fc.discardActiveObject();
14999
+ } finally {
15000
+ skipActiveSelectionBakeOnClearRef.current = false;
15001
+ skipSelectionClearOnDiscardRef.current = false;
15002
+ }
15003
+ }
15004
+ }
14989
15005
  const currentFabricObjects = /* @__PURE__ */ new Map();
14990
15006
  fc.getObjects().forEach((obj) => {
14991
15007
  const id = getObjectId(obj);
@@ -14999,7 +15015,7 @@ const PageCanvas = forwardRef(
14999
15015
  const replacementById = !activeStillOnCanvas && activeId ? fc.getObjects().find((o) => getObjectId(o) === activeId) ?? null : null;
15000
15016
  const restoreTarget = activeStillOnCanvas ? activeBeforeSync : replacementById;
15001
15017
  const isActiveTextBeingEdited = activeId && editingTextIdRef.current === activeId && activeBeforeSync instanceof fabric.Textbox;
15002
- if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2) {
15018
+ if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync) {
15003
15019
  const freshMembers = activeSelectionSnapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
15004
15020
  if (freshMembers.length > 1) {
15005
15021
  isSyncingSelectionToFabricRef.current = true;
@@ -15424,7 +15440,8 @@ const PageCanvas = forwardRef(
15424
15440
  continue;
15425
15441
  }
15426
15442
  if (existingObj instanceof fabric.Group && existingObj.__cropGroup) {
15427
- updateFabricObject(existingObj, element, wasJustModified);
15443
+ const forceStorePositionSync2 = forceLogicalGroupStorePositionSyncIds.has(element.id);
15444
+ updateFabricObject(existingObj, element, wasJustModified && !forceStorePositionSync2);
15428
15445
  existingObj.set({
15429
15446
  flipX: element.flipX ?? false,
15430
15447
  flipY: element.flipY ?? false,
@@ -15435,7 +15452,7 @@ const PageCanvas = forwardRef(
15435
15452
  if (wasJustModified) justModifiedIdsRef.current.delete(element.id);
15436
15453
  continue;
15437
15454
  }
15438
- if (existingObj instanceof fabric.Textbox && wasJustModified && !syncTriggeredByPanelRef.current) {
15455
+ if (existingObj instanceof fabric.Textbox && wasJustModified && !syncTriggeredByPanelRef.current && !forceLogicalGroupStorePositionSyncIds.has(element.id)) {
15439
15456
  justModifiedIdsRef.current.delete(element.id);
15440
15457
  continue;
15441
15458
  }
@@ -15454,7 +15471,8 @@ const PageCanvas = forwardRef(
15454
15471
  return node ? getAbsoluteBounds(node, pageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
15455
15472
  })() : { left: element.left ?? 0, top: element.top ?? 0 };
15456
15473
  const comparePosForImg = getObjectSyncComparePosition(existingObj);
15457
- const preserveSelectionMemberPosition = shouldPreserveActiveSelectionMemberPosition(existingObj);
15474
+ const forceStorePositionSync = forceLogicalGroupStorePositionSyncIds.has(element.id);
15475
+ const preserveSelectionMemberPosition = !forceStorePositionSync && shouldPreserveActiveSelectionMemberPosition(existingObj);
15458
15476
  const positionChanged = !preserveSelectionMemberPosition && (Math.abs(comparePosForImg.left - storePosForImg.left) > 0.1 || Math.abs(comparePosForImg.top - storePosForImg.top) > 0.1);
15459
15477
  if (visibilityChanged && !positionChanged || visibilityUpdateInProgressRef.current) {
15460
15478
  const isDynamicField = dynamicFieldIds.includes(element.id);
@@ -15470,7 +15488,7 @@ const PageCanvas = forwardRef(
15470
15488
  previousVisibilityRef.current.set(element.id, currentVisible);
15471
15489
  } else {
15472
15490
  if (!visibilityUpdateInProgressRef.current) {
15473
- updateFabricObject(existingObj, element, wasJustModified || preserveSelectionMemberPosition);
15491
+ updateFabricObject(existingObj, element, wasJustModified && !forceStorePositionSync || preserveSelectionMemberPosition);
15474
15492
  }
15475
15493
  const isDynamicField = dynamicFieldIds.includes(element.id);
15476
15494
  const canBeEvented = isEditorMode || isPreviewMode && isDynamicField;
@@ -15503,13 +15521,14 @@ const PageCanvas = forwardRef(
15503
15521
  const storeTop = storePos.top;
15504
15522
  const deltaX = Math.abs(fabricLeft - storeLeft);
15505
15523
  const deltaY = Math.abs(fabricTop - storeTop);
15506
- const preserveSelectionMemberPosition = shouldPreserveActiveSelectionMemberPosition(existingObj);
15524
+ const forceStorePositionSync = forceLogicalGroupStorePositionSyncIds.has(element.id);
15525
+ const preserveSelectionMemberPosition = !forceStorePositionSync && shouldPreserveActiveSelectionMemberPosition(existingObj);
15507
15526
  let positionChanged = !preserveSelectionMemberPosition && (deltaX > 0.1 || deltaY > 0.1);
15508
15527
  const activeObj = fc.getActiveObject();
15509
15528
  const isInActiveSelection = activeObj && (activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects().includes(existingObj) : activeObj === existingObj);
15510
15529
  const isInSelectedIds = selectedIdsFromStore.has(element.id);
15511
15530
  const isSelected = isInActiveSelection || isInSelectedIds;
15512
- if (positionChanged && isSelected && (wasJustModified || isBeingTransformed)) {
15531
+ if (positionChanged && isSelected && (wasJustModified || isBeingTransformed) && !forceStorePositionSync) {
15513
15532
  positionChanged = false;
15514
15533
  }
15515
15534
  const resolvedSizeForCompare = pageTree.length ? getNodeBounds(element, pageTree) : { width: typeof element.width === "number" ? element.width : 0, height: typeof element.height === "number" ? element.height : 0 };
@@ -15556,11 +15575,11 @@ const PageCanvas = forwardRef(
15556
15575
  });
15557
15576
  previousVisibilityRef.current.set(element.id, currentVisible);
15558
15577
  } else {
15559
- const skipPositionBecauseSelection = preserveSelectionMemberPosition || isSelected && (deltaX > 0.1 || deltaY > 0.1) && (wasJustModified || isBeingTransformed);
15578
+ const skipPositionBecauseSelection = preserveSelectionMemberPosition || !forceStorePositionSync && isSelected && (deltaX > 0.1 || deltaY > 0.1) && (wasJustModified || isBeingTransformed);
15560
15579
  const anyChange = positionChanged || otherPropsChanged || forceApplyFromPanel;
15561
15580
  if (!visibilityUpdateInProgressRef.current) {
15562
15581
  if (anyChange && !skipPositionBecauseSelection) {
15563
- updateFabricObject(existingObj, element, wasJustModified);
15582
+ updateFabricObject(existingObj, element, wasJustModified && !forceStorePositionSync);
15564
15583
  if (wasJustModified) justModifiedIdsRef.current.delete(element.id);
15565
15584
  } else if (skipPositionBecauseSelection && anyChange) {
15566
15585
  const savedLeft = existingObj.left;
@@ -23738,9 +23757,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23738
23757
  }
23739
23758
  return svgString;
23740
23759
  }
23741
- const resolvedPackageVersion = "0.5.272";
23760
+ const resolvedPackageVersion = "0.5.273";
23742
23761
  const PACKAGE_VERSION = resolvedPackageVersion;
23743
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.272";
23762
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.273";
23744
23763
  const roundParityValue = (value) => {
23745
23764
  if (typeof value !== "number") return value;
23746
23765
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24554,7 +24573,7 @@ class PixldocsRenderer {
24554
24573
  await this.waitForCanvasScene(container, cloned, i);
24555
24574
  }
24556
24575
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24557
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BySFN17q.js");
24576
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-D4O4QFHJ.js");
24558
24577
  const prepared = preparePagesForExport(
24559
24578
  cloned.pages,
24560
24579
  canvasWidth,
@@ -26874,7 +26893,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26874
26893
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26875
26894
  sanitizeSvgTreeForPdf(svgToDraw);
26876
26895
  try {
26877
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BySFN17q.js");
26896
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-D4O4QFHJ.js");
26878
26897
  try {
26879
26898
  await logTextMeasurementDiagnostic(svgToDraw);
26880
26899
  } catch {
@@ -27274,4 +27293,4 @@ export {
27274
27293
  buildTeaserBlurFlatKeys as y,
27275
27294
  collectFontDescriptorsFromConfig as z
27276
27295
  };
27277
- //# sourceMappingURL=index-CHIScvwH.js.map
27296
+ //# sourceMappingURL=index-DCqQEnix.js.map