@pixldocs/canvas-renderer 0.5.340 → 0.5.342

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.
@@ -11350,8 +11350,16 @@ const PageCanvas = forwardRef(
11350
11350
  const pageChildren2 = ((_a2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _a2.children) ?? [];
11351
11351
  const groupNode = findNodeById(pageChildren2, groupId);
11352
11352
  const groupAngle = groupNode && isGroup(groupNode) ? Number(groupNode.angle ?? 0) : 0;
11353
+ const groupAbs = groupNode && isGroup(groupNode) ? getAbsoluteBounds(groupNode, pageChildren2) : null;
11353
11354
  if (Number.isFinite(groupAngle) && Math.abs(groupAngle) > 0.01) {
11354
11355
  selection.set({ angle: groupAngle, scaleX: 1, scaleY: 1, skewX: 0, skewY: 0 });
11356
+ if (groupAbs) {
11357
+ selection.setPositionByOrigin(
11358
+ new fabric.Point(groupAbs.left + groupAbs.width / 2, groupAbs.top + groupAbs.height / 2),
11359
+ "center",
11360
+ "center"
11361
+ );
11362
+ }
11355
11363
  selection.setCoords();
11356
11364
  }
11357
11365
  } catch {
@@ -12822,13 +12830,18 @@ const PageCanvas = forwardRef(
12822
12830
  if (!groupNode) return;
12823
12831
  const groupAbs = getAbsoluteBounds(groupNode, pageChildren2);
12824
12832
  const rect = active.getBoundingRect();
12833
+ const center = active.getCenterPoint();
12825
12834
  groupSelectionTransformStartRef.current = {
12826
12835
  groupId,
12827
12836
  selection: active,
12828
12837
  selectionLeft: rect.left,
12829
12838
  selectionTop: rect.top,
12839
+ selectionCenterX: center.x,
12840
+ selectionCenterY: center.y,
12830
12841
  groupLeft: groupAbs.left,
12831
12842
  groupTop: groupAbs.top,
12843
+ groupWidth: groupAbs.width,
12844
+ groupHeight: groupAbs.height,
12832
12845
  selectionAngle: ((active.angle ?? 0) % 360 + 360) % 360
12833
12846
  };
12834
12847
  };
@@ -14479,6 +14492,10 @@ const PageCanvas = forwardRef(
14479
14492
  } catch (err) {
14480
14493
  console.warn("[Pixldocs][group-image-side-resize] modified-entry log failed", err);
14481
14494
  }
14495
+ const modifiedTarget = e.target;
14496
+ if (modifiedTarget instanceof fabric.ActiveSelection && modifiedTarget.getObjects().length === 0) {
14497
+ return;
14498
+ }
14482
14499
  try {
14483
14500
  const t = e.target;
14484
14501
  if (t instanceof fabric.ActiveSelection) {
@@ -14491,7 +14508,6 @@ const PageCanvas = forwardRef(
14491
14508
  }
14492
14509
  groupShiftReflowSnapshotRef.current = null;
14493
14510
  lockEdits();
14494
- const modifiedTarget = e.target;
14495
14511
  const modifiedTargetId = modifiedTarget ? getObjectId(modifiedTarget) : null;
14496
14512
  const modifiedTargetElement = modifiedTargetId ? elementsRef.current.find((el) => el.id === modifiedTargetId) : null;
14497
14513
  if (modifiedTarget && (modifiedTargetElement == null ? void 0 : modifiedTargetElement.type) === "shape") {
@@ -14905,6 +14921,44 @@ const PageCanvas = forwardRef(
14905
14921
  const currentSelAngle = isActiveSelection && activeObj ? normalizeAngle(activeObj.angle ?? 0) : 0;
14906
14922
  const angleDelta = shortestAngleDelta(currentSelAngle, startSelAngle);
14907
14923
  const hadRotation = isActiveSelection && activeObj && angleDelta > 0.01;
14924
+ if (activeGroupSelectionId === groupToMove.id && hadRotation && !hadScale && !activeSelectionResizeHandle && activeObj instanceof fabric.ActiveSelection) {
14925
+ const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
14926
+ const center = activeObj.getCenterPoint();
14927
+ const nextAbsLeft = center.x - groupAbs.width / 2;
14928
+ const nextAbsTop = center.y - groupAbs.height / 2;
14929
+ const storePos = absoluteToStorePosition(nextAbsLeft, nextAbsTop, groupToMove.id, pageChildren2);
14930
+ updateNodeStore(groupToMove.id, {
14931
+ left: storePos.left,
14932
+ top: storePos.top,
14933
+ angle: currentSelAngle
14934
+ }, { recordHistory: false, skipLayoutRecalc: true });
14935
+ commitHistoryStore();
14936
+ restoreGroupSelectionVisualState(activeObj, groupToMove.id);
14937
+ fabricCanvas.setActiveObject(activeObj);
14938
+ activeObj.setCoords();
14939
+ selectElements([groupToMove.id], false, false);
14940
+ fabricCanvas.requestRenderAll();
14941
+ elementsRef.current = getCurrentElements();
14942
+ const restoreSnapshot = {
14943
+ memberIds: activeObj.getObjects().map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__"),
14944
+ groupSelectionId: groupToMove.id,
14945
+ expiresAt: Date.now() + 1200
14946
+ };
14947
+ recentGroupSelectionRestoreRef.current = restoreSnapshot;
14948
+ activeObj.getObjects().forEach((obj) => {
14949
+ const objId = getObjectId(obj);
14950
+ if (objId && objId !== "__background__") {
14951
+ justModifiedIdsRef.current.add(objId);
14952
+ modifiedIdsThisRound.add(objId);
14953
+ }
14954
+ });
14955
+ setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
14956
+ groupSelectionTransformStartRef.current = null;
14957
+ activeSelectionMoveStartRef.current = null;
14958
+ activeSelectionResizeHandleRef.current = null;
14959
+ unlockEditsSoon();
14960
+ return;
14961
+ }
14908
14962
  if (!isActiveSelectionSideResize && !hadScale && !hadRotation && (Math.abs(deltaX) > 0.1 || Math.abs(deltaY) > 0.1)) {
14909
14963
  const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
14910
14964
  const newLeft = (groupToMove.left ?? 0) + deltaX;
@@ -24590,9 +24644,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24590
24644
  }
24591
24645
  return svgString;
24592
24646
  }
24593
- const resolvedPackageVersion = "0.5.340";
24647
+ const resolvedPackageVersion = "0.5.342";
24594
24648
  const PACKAGE_VERSION = resolvedPackageVersion;
24595
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.340";
24649
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.342";
24596
24650
  const roundParityValue = (value) => {
24597
24651
  if (typeof value !== "number") return value;
24598
24652
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25406,7 +25460,7 @@ class PixldocsRenderer {
25406
25460
  await this.waitForCanvasScene(container, cloned, i);
25407
25461
  }
25408
25462
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25409
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-eD9Y7zuY.js");
25463
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BW-Au2Xo.js");
25410
25464
  const prepared = preparePagesForExport(
25411
25465
  cloned.pages,
25412
25466
  canvasWidth,
@@ -27726,7 +27780,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27726
27780
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27727
27781
  sanitizeSvgTreeForPdf(svgToDraw);
27728
27782
  try {
27729
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-eD9Y7zuY.js");
27783
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BW-Au2Xo.js");
27730
27784
  try {
27731
27785
  await logTextMeasurementDiagnostic(svgToDraw);
27732
27786
  } catch {
@@ -28126,4 +28180,4 @@ export {
28126
28180
  buildTeaserBlurFlatKeys as y,
28127
28181
  collectFontDescriptorsFromConfig as z
28128
28182
  };
28129
- //# sourceMappingURL=index-DCyiaRZr.js.map
28183
+ //# sourceMappingURL=index-BQHFDZIZ.js.map