@pixldocs/canvas-renderer 0.5.428 → 0.5.430

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.
@@ -5021,7 +5021,13 @@ function updateCoverLayout(g) {
5021
5021
  scaleX: finalScale,
5022
5022
  scaleY: finalScale,
5023
5023
  originX: "center",
5024
- originY: "center"
5024
+ originY: "center",
5025
+ // Always keep inner bitmap axis-aligned within the frame; the parent
5026
+ // crop group owns the rotation. See createMaskedImageElement for the
5027
+ // full rationale.
5028
+ angle: 0,
5029
+ skewX: 0,
5030
+ skewY: 0
5025
5031
  });
5026
5032
  const dispW = iw * finalScale;
5027
5033
  const dispH = ih * finalScale;
@@ -5457,6 +5463,16 @@ async function createMaskedImageElement({
5457
5463
  evented: false,
5458
5464
  opacity: 1,
5459
5465
  // CRITICAL: Always 1 for child - group handles opacity
5466
+ // Force the inner bitmap's angle to 0 so it inherits ONLY the parent
5467
+ // crop group's rotation. Some image sources (e.g. previously-rotated
5468
+ // FabricImage objects, EXIF-baked PNGs, or drop-replacement payloads
5469
+ // that carried a stale `angle` from a logical group) arrive here with
5470
+ // a non-zero local angle. Without this reset the bitmap renders at
5471
+ // (groupAngle + imgAngle) after reload, while the frame only carries
5472
+ // groupAngle — making the photo look mis-rotated inside its frame.
5473
+ angle: 0,
5474
+ skewX: 0,
5475
+ skewY: 0,
5460
5476
  // Preserve image-level caching settings if they exist
5461
5477
  objectCaching: img.objectCaching ?? false,
5462
5478
  noScaleCache: img.noScaleCache ?? true
@@ -16479,6 +16495,25 @@ const PageCanvas = forwardRef(
16479
16495
  }
16480
16496
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
16481
16497
  obj.setCoords();
16498
+ try {
16499
+ const isImg = obj instanceof fabric.FabricImage || obj.__cropGroup;
16500
+ if (isImg) {
16501
+ console.log("[Pixldocs:rotation-persist]", {
16502
+ objId,
16503
+ fabricType: obj.type,
16504
+ isCropGroup: !!obj.__cropGroup,
16505
+ isActiveSelection,
16506
+ objAngle: obj.angle,
16507
+ activeAngle: activeObj == null ? void 0 : activeObj.angle,
16508
+ decomposedAngle: decomposed == null ? void 0 : decomposed.angle,
16509
+ persistedAngle: elementUpdate.angle,
16510
+ persistedLeft: elementUpdate.left,
16511
+ persistedTop: elementUpdate.top,
16512
+ sourceElementAngle: sourceElement == null ? void 0 : sourceElement.angle
16513
+ });
16514
+ }
16515
+ } catch {
16516
+ }
16482
16517
  }
16483
16518
  const pageChildrenForReflow = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
16484
16519
  const stackGroupsToReflow = /* @__PURE__ */ new Set();
@@ -16650,7 +16685,7 @@ const PageCanvas = forwardRef(
16650
16685
  }
16651
16686
  });
16652
16687
  fabricCanvas.on("mouse:dblclick", (e) => {
16653
- var _a2, _b2;
16688
+ var _a2, _b2, _c2;
16654
16689
  if (!isActiveRef.current || !allowEditing) return;
16655
16690
  let target = e.target;
16656
16691
  if (!target) {
@@ -16662,6 +16697,16 @@ const PageCanvas = forwardRef(
16662
16697
  const innerImg = ct == null ? void 0 : ct._img;
16663
16698
  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) || "";
16664
16699
  const isPlaceholder = !innerSrc || innerSrc === EMPTY_IMAGE_PLACEHOLDER_DATA_URL;
16700
+ const targetId = getObjectId(target);
16701
+ const pageChildrenForCrop = ((_c2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c2.children) ?? [];
16702
+ const parentForCrop = targetId ? findParentGroup(pageChildrenForCrop, targetId) : null;
16703
+ const isInsideGroup = !!parentForCrop;
16704
+ 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;
16709
+ }
16665
16710
  if (innerImg && !isPlaceholder && !isCropGroupInCropMode(target)) {
16666
16711
  enterCropMode(target);
16667
16712
  return;
@@ -25688,9 +25733,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25688
25733
  }
25689
25734
  return svgString;
25690
25735
  }
25691
- const resolvedPackageVersion = "0.5.428";
25736
+ const resolvedPackageVersion = "0.5.430";
25692
25737
  const PACKAGE_VERSION = resolvedPackageVersion;
25693
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.428";
25738
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.430";
25694
25739
  const roundParityValue = (value) => {
25695
25740
  if (typeof value !== "number") return value;
25696
25741
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26504,7 +26549,7 @@ class PixldocsRenderer {
26504
26549
  await this.waitForCanvasScene(container, cloned, i);
26505
26550
  }
26506
26551
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26507
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CsSQj8-v.js");
26552
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DIqgjv2w.js");
26508
26553
  const prepared = preparePagesForExport(
26509
26554
  cloned.pages,
26510
26555
  canvasWidth,
@@ -28824,7 +28869,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28824
28869
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28825
28870
  sanitizeSvgTreeForPdf(svgToDraw);
28826
28871
  try {
28827
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CsSQj8-v.js");
28872
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DIqgjv2w.js");
28828
28873
  try {
28829
28874
  await logTextMeasurementDiagnostic(svgToDraw);
28830
28875
  } catch {
@@ -29224,4 +29269,4 @@ export {
29224
29269
  buildTeaserBlurFlatKeys as y,
29225
29270
  collectFontDescriptorsFromConfig as z
29226
29271
  };
29227
- //# sourceMappingURL=index-lHxjPVDE.js.map
29272
+ //# sourceMappingURL=index-Bae6ojJH.js.map