@pixldocs/canvas-renderer 0.5.429 → 0.5.431

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.
@@ -5039,7 +5039,13 @@ function updateCoverLayout(g) {
5039
5039
  scaleX: finalScale,
5040
5040
  scaleY: finalScale,
5041
5041
  originX: "center",
5042
- originY: "center"
5042
+ originY: "center",
5043
+ // Always keep inner bitmap axis-aligned within the frame; the parent
5044
+ // crop group owns the rotation. See createMaskedImageElement for the
5045
+ // full rationale.
5046
+ angle: 0,
5047
+ skewX: 0,
5048
+ skewY: 0
5043
5049
  });
5044
5050
  const dispW = iw * finalScale;
5045
5051
  const dispH = ih * finalScale;
@@ -5475,6 +5481,16 @@ async function createMaskedImageElement({
5475
5481
  evented: false,
5476
5482
  opacity: 1,
5477
5483
  // CRITICAL: Always 1 for child - group handles opacity
5484
+ // Force the inner bitmap's angle to 0 so it inherits ONLY the parent
5485
+ // crop group's rotation. Some image sources (e.g. previously-rotated
5486
+ // FabricImage objects, EXIF-baked PNGs, or drop-replacement payloads
5487
+ // that carried a stale `angle` from a logical group) arrive here with
5488
+ // a non-zero local angle. Without this reset the bitmap renders at
5489
+ // (groupAngle + imgAngle) after reload, while the frame only carries
5490
+ // groupAngle — making the photo look mis-rotated inside its frame.
5491
+ angle: 0,
5492
+ skewX: 0,
5493
+ skewY: 0,
5478
5494
  // Preserve image-level caching settings if they exist
5479
5495
  objectCaching: img.objectCaching ?? false,
5480
5496
  noScaleCache: img.noScaleCache ?? true
@@ -16687,7 +16703,7 @@ const PageCanvas = react.forwardRef(
16687
16703
  }
16688
16704
  });
16689
16705
  fabricCanvas.on("mouse:dblclick", (e) => {
16690
- var _a2, _b2;
16706
+ var _a2, _b2, _c2;
16691
16707
  if (!isActiveRef.current || !allowEditing) return;
16692
16708
  let target = e.target;
16693
16709
  if (!target) {
@@ -16699,6 +16715,23 @@ const PageCanvas = react.forwardRef(
16699
16715
  const innerImg = ct == null ? void 0 : ct._img;
16700
16716
  const innerSrc = ((_a2 = innerImg == null ? void 0 : innerImg.getSrc) == null ? void 0 : _a2.call(innerImg)) || ((_b2 = innerImg == null ? void 0 : innerImg._originalElement) == null ? void 0 : _b2.src) || (innerImg == null ? void 0 : innerImg.src) || "";
16701
16717
  const isPlaceholder = !innerSrc || innerSrc === EMPTY_IMAGE_PLACEHOLDER_DATA_URL;
16718
+ const targetId = getObjectId(target);
16719
+ const pageChildrenForCrop = ((_c2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c2.children) ?? [];
16720
+ const parentForCrop = targetId ? findParentGroup(pageChildrenForCrop, targetId) : null;
16721
+ const isInsideGroup = !!parentForCrop;
16722
+ if (isInsideGroup) {
16723
+ const active = fabricCanvas.getActiveObject();
16724
+ const isIndividuallySelected = active === target;
16725
+ if (!isIndividuallySelected) {
16726
+ try {
16727
+ fabricCanvas.discardActiveObject();
16728
+ fabricCanvas.setActiveObject(target);
16729
+ fabricCanvas.requestRenderAll();
16730
+ } catch {
16731
+ }
16732
+ return;
16733
+ }
16734
+ }
16702
16735
  if (innerImg && !isPlaceholder && !isCropGroupInCropMode(target)) {
16703
16736
  enterCropMode(target);
16704
16737
  return;
@@ -25725,9 +25758,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25725
25758
  }
25726
25759
  return svgString;
25727
25760
  }
25728
- const resolvedPackageVersion = "0.5.429";
25761
+ const resolvedPackageVersion = "0.5.431";
25729
25762
  const PACKAGE_VERSION = resolvedPackageVersion;
25730
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.429";
25763
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.431";
25731
25764
  const roundParityValue = (value) => {
25732
25765
  if (typeof value !== "number") return value;
25733
25766
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26541,7 +26574,7 @@ class PixldocsRenderer {
26541
26574
  await this.waitForCanvasScene(container, cloned, i);
26542
26575
  }
26543
26576
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26544
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DmvWFSzg.cjs"));
26577
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-zM3-7B0b.cjs"));
26545
26578
  const prepared = preparePagesForExport(
26546
26579
  cloned.pages,
26547
26580
  canvasWidth,
@@ -28861,7 +28894,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28861
28894
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28862
28895
  sanitizeSvgTreeForPdf(svgToDraw);
28863
28896
  try {
28864
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DmvWFSzg.cjs"));
28897
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-zM3-7B0b.cjs"));
28865
28898
  try {
28866
28899
  await logTextMeasurementDiagnostic(svgToDraw);
28867
28900
  } catch {
@@ -29258,4 +29291,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29258
29291
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29259
29292
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29260
29293
  exports.warmTemplateFromForm = warmTemplateFromForm;
29261
- //# sourceMappingURL=index-CKx2zlez.cjs.map
29294
+ //# sourceMappingURL=index-Ce2dA8D0.cjs.map