@pixldocs/canvas-renderer 0.5.342 → 0.5.343

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.
@@ -13179,6 +13179,9 @@ const PageCanvas = forwardRef(
13179
13179
  fabricCanvas.on("mouse:down:before", (opt) => {
13180
13180
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
13181
13181
  const activeBeforeMouseDown = fabricCanvas.getActiveObject();
13182
+ if (activeBeforeMouseDown instanceof fabric.ActiveSelection && activeBeforeMouseDown.__pixldocsGroupSelection) {
13183
+ prepareGroupSelectionTransformStart(activeBeforeMouseDown);
13184
+ }
13182
13185
  if (editLockRef.current) {
13183
13186
  const active = fabricCanvas.getActiveObject();
13184
13187
  if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
@@ -13278,6 +13281,7 @@ const PageCanvas = forwardRef(
13278
13281
  restoreGroupSelectionVisualState(selection, parent.id);
13279
13282
  fabricCanvas.setActiveObject(selection);
13280
13283
  selection.setCoords();
13284
+ prepareGroupSelectionTransformStart(selection);
13281
13285
  fabricCanvas._target = selection;
13282
13286
  opt.target = selection;
13283
13287
  pendingGroupPromotionRef.current = { groupId: parent.id, selection };
@@ -13320,6 +13324,7 @@ const PageCanvas = forwardRef(
13320
13324
  restoreGroupSelectionVisualState(selection, parent.id);
13321
13325
  fabricCanvas.setActiveObject(selection);
13322
13326
  selection.setCoords();
13327
+ prepareGroupSelectionTransformStart(selection);
13323
13328
  fabricCanvas._target = selection;
13324
13329
  opt.target = selection;
13325
13330
  pendingGroupPromotionRef.current = { groupId: parent.id, selection };
@@ -14877,9 +14882,9 @@ const PageCanvas = forwardRef(
14877
14882
  let movedGroupLeft = groupAbs.left;
14878
14883
  let movedGroupTop = groupAbs.top;
14879
14884
  if (activeObj instanceof fabric.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
14880
- const selectionRect = activeObj.getBoundingRect();
14881
- movedGroupLeft = transformStart.groupLeft + (selectionRect.left - transformStart.selectionLeft);
14882
- movedGroupTop = transformStart.groupTop + (selectionRect.top - transformStart.selectionTop);
14885
+ const selectionCenter = activeObj.getCenterPoint();
14886
+ movedGroupLeft = transformStart.groupLeft + (selectionCenter.x - transformStart.selectionCenterX);
14887
+ movedGroupTop = transformStart.groupTop + (selectionCenter.y - transformStart.selectionCenterY);
14883
14888
  } else if (activeObj instanceof fabric.ActiveSelection && firstId && firstObj) {
14884
14889
  const firstNode = findNodeById(pageChildren2, firstId);
14885
14890
  if (firstNode) {
@@ -14924,8 +14929,10 @@ const PageCanvas = forwardRef(
14924
14929
  if (activeGroupSelectionId === groupToMove.id && hadRotation && !hadScale && !activeSelectionResizeHandle && activeObj instanceof fabric.ActiveSelection) {
14925
14930
  const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
14926
14931
  const center = activeObj.getCenterPoint();
14927
- const nextAbsLeft = center.x - groupAbs.width / 2;
14928
- const nextAbsTop = center.y - groupAbs.height / 2;
14932
+ const baseCenterX = (transformStart == null ? void 0 : transformStart.selectionCenterX) ?? center.x;
14933
+ const baseCenterY = (transformStart == null ? void 0 : transformStart.selectionCenterY) ?? center.y;
14934
+ const nextAbsLeft = groupAbs.left + (center.x - baseCenterX);
14935
+ const nextAbsTop = groupAbs.top + (center.y - baseCenterY);
14929
14936
  const storePos = absoluteToStorePosition(nextAbsLeft, nextAbsTop, groupToMove.id, pageChildren2);
14930
14937
  updateNodeStore(groupToMove.id, {
14931
14938
  left: storePos.left,
@@ -15631,6 +15638,7 @@ const PageCanvas = forwardRef(
15631
15638
  const activeObj = fabricCanvas.getActiveObject();
15632
15639
  if (!(activeObj instanceof fabric.ActiveSelection)) return;
15633
15640
  if (skipActiveSelectionBakeOnClearRef.current) return;
15641
+ if (activeObj.__pixldocsGroupSelection) return;
15634
15642
  const selectionMatrix = activeObj.calcTransformMatrix();
15635
15643
  for (const obj of deselected) {
15636
15644
  const objId = getObjectId(obj);
@@ -24644,9 +24652,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24644
24652
  }
24645
24653
  return svgString;
24646
24654
  }
24647
- const resolvedPackageVersion = "0.5.342";
24655
+ const resolvedPackageVersion = "0.5.343";
24648
24656
  const PACKAGE_VERSION = resolvedPackageVersion;
24649
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.342";
24657
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.343";
24650
24658
  const roundParityValue = (value) => {
24651
24659
  if (typeof value !== "number") return value;
24652
24660
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25460,7 +25468,7 @@ class PixldocsRenderer {
25460
25468
  await this.waitForCanvasScene(container, cloned, i);
25461
25469
  }
25462
25470
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25463
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BW-Au2Xo.js");
25471
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DWz1fLQ7.js");
25464
25472
  const prepared = preparePagesForExport(
25465
25473
  cloned.pages,
25466
25474
  canvasWidth,
@@ -27780,7 +27788,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27780
27788
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27781
27789
  sanitizeSvgTreeForPdf(svgToDraw);
27782
27790
  try {
27783
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BW-Au2Xo.js");
27791
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DWz1fLQ7.js");
27784
27792
  try {
27785
27793
  await logTextMeasurementDiagnostic(svgToDraw);
27786
27794
  } catch {
@@ -28180,4 +28188,4 @@ export {
28180
28188
  buildTeaserBlurFlatKeys as y,
28181
28189
  collectFontDescriptorsFromConfig as z
28182
28190
  };
28183
- //# sourceMappingURL=index-BQHFDZIZ.js.map
28191
+ //# sourceMappingURL=index-JXiTI3jA.js.map