@pixldocs/canvas-renderer 0.5.430 → 0.5.432

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.
@@ -13969,10 +13969,32 @@ const PageCanvas = forwardRef(
13969
13969
  if (!isGroup(node)) continue;
13970
13970
  if (node.backgroundColor) continue;
13971
13971
  if (activeEditingGroupId && node.id === activeEditingGroupId) continue;
13972
- const b = groupFabricUnionBBox(node);
13973
- if (!b) continue;
13974
- if (px < b.left || py < b.top || px > b.right || py > b.bottom) continue;
13975
- const area = Math.max(1, (b.right - b.left) * (b.bottom - b.top));
13972
+ const oriented = groupFabricOrientedBBox(node);
13973
+ let inside = false;
13974
+ let area = 0;
13975
+ if (oriented && Math.abs(oriented.angle) > 0.01) {
13976
+ const rad = -oriented.angle * Math.PI / 180;
13977
+ const cos = Math.cos(rad), sin = Math.sin(rad);
13978
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
13979
+ for (const p of oriented.corners) {
13980
+ const xr2 = p.x * cos - p.y * sin;
13981
+ const yr2 = p.x * sin + p.y * cos;
13982
+ if (xr2 < minX) minX = xr2;
13983
+ if (yr2 < minY) minY = yr2;
13984
+ if (xr2 > maxX) maxX = xr2;
13985
+ if (yr2 > maxY) maxY = yr2;
13986
+ }
13987
+ const xr = px * cos - py * sin;
13988
+ const yr = px * sin + py * cos;
13989
+ inside = xr >= minX && xr <= maxX && yr >= minY && yr <= maxY;
13990
+ area = Math.max(1, (maxX - minX) * (maxY - minY));
13991
+ } else {
13992
+ const b = groupFabricUnionBBox(node);
13993
+ if (!b) continue;
13994
+ inside = !(px < b.left || py < b.top || px > b.right || py > b.bottom);
13995
+ area = Math.max(1, (b.right - b.left) * (b.bottom - b.top));
13996
+ }
13997
+ if (!inside) continue;
13976
13998
  if (!pick || area < pick.area) pick = { group: node, area };
13977
13999
  }
13978
14000
  return pick;
@@ -16702,10 +16724,17 @@ const PageCanvas = forwardRef(
16702
16724
  const parentForCrop = targetId ? findParentGroup(pageChildrenForCrop, targetId) : null;
16703
16725
  const isInsideGroup = !!parentForCrop;
16704
16726
  if (isInsideGroup) {
16705
- toast.info("Ungroup to crop this image", {
16706
- description: "Crop mode is disabled for images inside a group. Select the group and ungroup first."
16707
- });
16708
- return;
16727
+ const active = fabricCanvas.getActiveObject();
16728
+ const isIndividuallySelected = active === target;
16729
+ if (!isIndividuallySelected) {
16730
+ try {
16731
+ fabricCanvas.discardActiveObject();
16732
+ fabricCanvas.setActiveObject(target);
16733
+ fabricCanvas.requestRenderAll();
16734
+ } catch {
16735
+ }
16736
+ return;
16737
+ }
16709
16738
  }
16710
16739
  if (innerImg && !isPlaceholder && !isCropGroupInCropMode(target)) {
16711
16740
  enterCropMode(target);
@@ -25733,9 +25762,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25733
25762
  }
25734
25763
  return svgString;
25735
25764
  }
25736
- const resolvedPackageVersion = "0.5.430";
25765
+ const resolvedPackageVersion = "0.5.432";
25737
25766
  const PACKAGE_VERSION = resolvedPackageVersion;
25738
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.430";
25767
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.432";
25739
25768
  const roundParityValue = (value) => {
25740
25769
  if (typeof value !== "number") return value;
25741
25770
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26549,7 +26578,7 @@ class PixldocsRenderer {
26549
26578
  await this.waitForCanvasScene(container, cloned, i);
26550
26579
  }
26551
26580
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26552
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DIqgjv2w.js");
26581
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bkipkjlc.js");
26553
26582
  const prepared = preparePagesForExport(
26554
26583
  cloned.pages,
26555
26584
  canvasWidth,
@@ -28869,7 +28898,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28869
28898
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28870
28899
  sanitizeSvgTreeForPdf(svgToDraw);
28871
28900
  try {
28872
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DIqgjv2w.js");
28901
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bkipkjlc.js");
28873
28902
  try {
28874
28903
  await logTextMeasurementDiagnostic(svgToDraw);
28875
28904
  } catch {
@@ -29269,4 +29298,4 @@ export {
29269
29298
  buildTeaserBlurFlatKeys as y,
29270
29299
  collectFontDescriptorsFromConfig as z
29271
29300
  };
29272
- //# sourceMappingURL=index-Bae6ojJH.js.map
29301
+ //# sourceMappingURL=index-gL0A2DGr.js.map