@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.
@@ -13197,6 +13197,9 @@ const PageCanvas = react.forwardRef(
13197
13197
  fabricCanvas.on("mouse:down:before", (opt) => {
13198
13198
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
13199
13199
  const activeBeforeMouseDown = fabricCanvas.getActiveObject();
13200
+ if (activeBeforeMouseDown instanceof fabric__namespace.ActiveSelection && activeBeforeMouseDown.__pixldocsGroupSelection) {
13201
+ prepareGroupSelectionTransformStart(activeBeforeMouseDown);
13202
+ }
13200
13203
  if (editLockRef.current) {
13201
13204
  const active = fabricCanvas.getActiveObject();
13202
13205
  if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
@@ -13296,6 +13299,7 @@ const PageCanvas = react.forwardRef(
13296
13299
  restoreGroupSelectionVisualState(selection, parent.id);
13297
13300
  fabricCanvas.setActiveObject(selection);
13298
13301
  selection.setCoords();
13302
+ prepareGroupSelectionTransformStart(selection);
13299
13303
  fabricCanvas._target = selection;
13300
13304
  opt.target = selection;
13301
13305
  pendingGroupPromotionRef.current = { groupId: parent.id, selection };
@@ -13338,6 +13342,7 @@ const PageCanvas = react.forwardRef(
13338
13342
  restoreGroupSelectionVisualState(selection, parent.id);
13339
13343
  fabricCanvas.setActiveObject(selection);
13340
13344
  selection.setCoords();
13345
+ prepareGroupSelectionTransformStart(selection);
13341
13346
  fabricCanvas._target = selection;
13342
13347
  opt.target = selection;
13343
13348
  pendingGroupPromotionRef.current = { groupId: parent.id, selection };
@@ -14510,6 +14515,10 @@ const PageCanvas = react.forwardRef(
14510
14515
  } catch (err) {
14511
14516
  console.warn("[Pixldocs][group-image-side-resize] modified-entry log failed", err);
14512
14517
  }
14518
+ const modifiedTarget = e.target;
14519
+ if (modifiedTarget instanceof fabric__namespace.ActiveSelection && modifiedTarget.getObjects().length === 0) {
14520
+ return;
14521
+ }
14513
14522
  try {
14514
14523
  const t = e.target;
14515
14524
  if (t instanceof fabric__namespace.ActiveSelection) {
@@ -14522,7 +14531,6 @@ const PageCanvas = react.forwardRef(
14522
14531
  }
14523
14532
  groupShiftReflowSnapshotRef.current = null;
14524
14533
  lockEdits();
14525
- const modifiedTarget = e.target;
14526
14534
  const modifiedTargetId = modifiedTarget ? getObjectId(modifiedTarget) : null;
14527
14535
  const modifiedTargetElement = modifiedTargetId ? elementsRef.current.find((el) => el.id === modifiedTargetId) : null;
14528
14536
  if (modifiedTarget && (modifiedTargetElement == null ? void 0 : modifiedTargetElement.type) === "shape") {
@@ -14892,9 +14900,9 @@ const PageCanvas = react.forwardRef(
14892
14900
  let movedGroupLeft = groupAbs.left;
14893
14901
  let movedGroupTop = groupAbs.top;
14894
14902
  if (activeObj instanceof fabric__namespace.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
14895
- const selectionRect = activeObj.getBoundingRect();
14896
- movedGroupLeft = transformStart.groupLeft + (selectionRect.left - transformStart.selectionLeft);
14897
- movedGroupTop = transformStart.groupTop + (selectionRect.top - transformStart.selectionTop);
14903
+ const selectionCenter = activeObj.getCenterPoint();
14904
+ movedGroupLeft = transformStart.groupLeft + (selectionCenter.x - transformStart.selectionCenterX);
14905
+ movedGroupTop = transformStart.groupTop + (selectionCenter.y - transformStart.selectionCenterY);
14898
14906
  } else if (activeObj instanceof fabric__namespace.ActiveSelection && firstId && firstObj) {
14899
14907
  const firstNode = findNodeById(pageChildren2, firstId);
14900
14908
  if (firstNode) {
@@ -14939,8 +14947,10 @@ const PageCanvas = react.forwardRef(
14939
14947
  if (activeGroupSelectionId === groupToMove.id && hadRotation && !hadScale && !activeSelectionResizeHandle && activeObj instanceof fabric__namespace.ActiveSelection) {
14940
14948
  const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
14941
14949
  const center = activeObj.getCenterPoint();
14942
- const nextAbsLeft = center.x - groupAbs.width / 2;
14943
- const nextAbsTop = center.y - groupAbs.height / 2;
14950
+ const baseCenterX = (transformStart == null ? void 0 : transformStart.selectionCenterX) ?? center.x;
14951
+ const baseCenterY = (transformStart == null ? void 0 : transformStart.selectionCenterY) ?? center.y;
14952
+ const nextAbsLeft = groupAbs.left + (center.x - baseCenterX);
14953
+ const nextAbsTop = groupAbs.top + (center.y - baseCenterY);
14944
14954
  const storePos = absoluteToStorePosition(nextAbsLeft, nextAbsTop, groupToMove.id, pageChildren2);
14945
14955
  updateNodeStore(groupToMove.id, {
14946
14956
  left: storePos.left,
@@ -15646,6 +15656,7 @@ const PageCanvas = react.forwardRef(
15646
15656
  const activeObj = fabricCanvas.getActiveObject();
15647
15657
  if (!(activeObj instanceof fabric__namespace.ActiveSelection)) return;
15648
15658
  if (skipActiveSelectionBakeOnClearRef.current) return;
15659
+ if (activeObj.__pixldocsGroupSelection) return;
15649
15660
  const selectionMatrix = activeObj.calcTransformMatrix();
15650
15661
  for (const obj of deselected) {
15651
15662
  const objId = getObjectId(obj);
@@ -24659,9 +24670,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24659
24670
  }
24660
24671
  return svgString;
24661
24672
  }
24662
- const resolvedPackageVersion = "0.5.341";
24673
+ const resolvedPackageVersion = "0.5.343";
24663
24674
  const PACKAGE_VERSION = resolvedPackageVersion;
24664
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.341";
24675
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.343";
24665
24676
  const roundParityValue = (value) => {
24666
24677
  if (typeof value !== "number") return value;
24667
24678
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25475,7 +25486,7 @@ class PixldocsRenderer {
25475
25486
  await this.waitForCanvasScene(container, cloned, i);
25476
25487
  }
25477
25488
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25478
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DFKAha9Z.cjs"));
25489
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CdDnoHs2.cjs"));
25479
25490
  const prepared = preparePagesForExport(
25480
25491
  cloned.pages,
25481
25492
  canvasWidth,
@@ -27795,7 +27806,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27795
27806
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27796
27807
  sanitizeSvgTreeForPdf(svgToDraw);
27797
27808
  try {
27798
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DFKAha9Z.cjs"));
27809
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CdDnoHs2.cjs"));
27799
27810
  try {
27800
27811
  await logTextMeasurementDiagnostic(svgToDraw);
27801
27812
  } catch {
@@ -28192,4 +28203,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28192
28203
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28193
28204
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28194
28205
  exports.warmTemplateFromForm = warmTemplateFromForm;
28195
- //# sourceMappingURL=index-Diz7LWkR.cjs.map
28206
+ //# sourceMappingURL=index-BVDxgitP.cjs.map