@pixldocs/canvas-renderer 0.5.341 → 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 };
@@ -14492,6 +14497,10 @@ const PageCanvas = forwardRef(
14492
14497
  } catch (err) {
14493
14498
  console.warn("[Pixldocs][group-image-side-resize] modified-entry log failed", err);
14494
14499
  }
14500
+ const modifiedTarget = e.target;
14501
+ if (modifiedTarget instanceof fabric.ActiveSelection && modifiedTarget.getObjects().length === 0) {
14502
+ return;
14503
+ }
14495
14504
  try {
14496
14505
  const t = e.target;
14497
14506
  if (t instanceof fabric.ActiveSelection) {
@@ -14504,7 +14513,6 @@ const PageCanvas = forwardRef(
14504
14513
  }
14505
14514
  groupShiftReflowSnapshotRef.current = null;
14506
14515
  lockEdits();
14507
- const modifiedTarget = e.target;
14508
14516
  const modifiedTargetId = modifiedTarget ? getObjectId(modifiedTarget) : null;
14509
14517
  const modifiedTargetElement = modifiedTargetId ? elementsRef.current.find((el) => el.id === modifiedTargetId) : null;
14510
14518
  if (modifiedTarget && (modifiedTargetElement == null ? void 0 : modifiedTargetElement.type) === "shape") {
@@ -14874,9 +14882,9 @@ const PageCanvas = forwardRef(
14874
14882
  let movedGroupLeft = groupAbs.left;
14875
14883
  let movedGroupTop = groupAbs.top;
14876
14884
  if (activeObj instanceof fabric.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
14877
- const selectionRect = activeObj.getBoundingRect();
14878
- movedGroupLeft = transformStart.groupLeft + (selectionRect.left - transformStart.selectionLeft);
14879
- 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);
14880
14888
  } else if (activeObj instanceof fabric.ActiveSelection && firstId && firstObj) {
14881
14889
  const firstNode = findNodeById(pageChildren2, firstId);
14882
14890
  if (firstNode) {
@@ -14921,8 +14929,10 @@ const PageCanvas = forwardRef(
14921
14929
  if (activeGroupSelectionId === groupToMove.id && hadRotation && !hadScale && !activeSelectionResizeHandle && activeObj instanceof fabric.ActiveSelection) {
14922
14930
  const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
14923
14931
  const center = activeObj.getCenterPoint();
14924
- const nextAbsLeft = center.x - groupAbs.width / 2;
14925
- 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);
14926
14936
  const storePos = absoluteToStorePosition(nextAbsLeft, nextAbsTop, groupToMove.id, pageChildren2);
14927
14937
  updateNodeStore(groupToMove.id, {
14928
14938
  left: storePos.left,
@@ -15628,6 +15638,7 @@ const PageCanvas = forwardRef(
15628
15638
  const activeObj = fabricCanvas.getActiveObject();
15629
15639
  if (!(activeObj instanceof fabric.ActiveSelection)) return;
15630
15640
  if (skipActiveSelectionBakeOnClearRef.current) return;
15641
+ if (activeObj.__pixldocsGroupSelection) return;
15631
15642
  const selectionMatrix = activeObj.calcTransformMatrix();
15632
15643
  for (const obj of deselected) {
15633
15644
  const objId = getObjectId(obj);
@@ -24641,9 +24652,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24641
24652
  }
24642
24653
  return svgString;
24643
24654
  }
24644
- const resolvedPackageVersion = "0.5.341";
24655
+ const resolvedPackageVersion = "0.5.343";
24645
24656
  const PACKAGE_VERSION = resolvedPackageVersion;
24646
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.341";
24657
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.343";
24647
24658
  const roundParityValue = (value) => {
24648
24659
  if (typeof value !== "number") return value;
24649
24660
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25457,7 +25468,7 @@ class PixldocsRenderer {
25457
25468
  await this.waitForCanvasScene(container, cloned, i);
25458
25469
  }
25459
25470
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25460
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bq49zb70.js");
25471
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DWz1fLQ7.js");
25461
25472
  const prepared = preparePagesForExport(
25462
25473
  cloned.pages,
25463
25474
  canvasWidth,
@@ -27777,7 +27788,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27777
27788
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27778
27789
  sanitizeSvgTreeForPdf(svgToDraw);
27779
27790
  try {
27780
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bq49zb70.js");
27791
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DWz1fLQ7.js");
27781
27792
  try {
27782
27793
  await logTextMeasurementDiagnostic(svgToDraw);
27783
27794
  } catch {
@@ -28177,4 +28188,4 @@ export {
28177
28188
  buildTeaserBlurFlatKeys as y,
28178
28189
  collectFontDescriptorsFromConfig as z
28179
28190
  };
28180
- //# sourceMappingURL=index-8AH1NCZZ.js.map
28191
+ //# sourceMappingURL=index-JXiTI3jA.js.map