@pixldocs/canvas-renderer 0.5.467 → 0.5.468

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.
@@ -5237,22 +5237,6 @@ function updateCoverLayout(g) {
5237
5237
  if (g.clipPath) {
5238
5238
  g.clipPath.dirty = true;
5239
5239
  }
5240
- if (fitContain && g.clipPath) {
5241
- const clip = g.clipPath;
5242
- const isSpecialMask = isSvgMaskClipPath(clip) || isLuminanceMaskClipPath(clip) || clip.__svgMask || clip.__edgeFadeMask;
5243
- if (!isSpecialMask) {
5244
- const clipW = Math.max(frameW, dispW);
5245
- const clipH = Math.max(frameH, dispH);
5246
- if (clip instanceof fabric.Rect) {
5247
- const rxRatioCt = Number(ct.rx) || 0;
5248
- const rxPx = rxRatioCt > 0.5 ? Math.min(rxRatioCt, clipW / 2, clipH / 2) : Math.max(0, Math.min(rxRatioCt * Math.min(clipW, clipH), clipW / 2, clipH / 2));
5249
- clip.set({ width: clipW, height: clipH, rx: rxPx, ry: rxPx, left: offsetX, top: offsetY });
5250
- } else if (clip instanceof fabric.Ellipse) {
5251
- clip.set({ rx: clipW / 2, ry: clipH / 2, left: offsetX, top: offsetY });
5252
- }
5253
- clip.dirty = true;
5254
- }
5255
- }
5256
5240
  finalizeCropGroupCoords(g);
5257
5241
  if (g.canvas) {
5258
5242
  g.setCoords();
@@ -12297,18 +12281,21 @@ const PageCanvas = forwardRef(
12297
12281
  if (id && id !== "__background__") {
12298
12282
  const width = (obj.width ?? 0) * (obj.scaleX ?? 1);
12299
12283
  const height = (obj.height ?? 0) * (obj.scaleY ?? 1);
12300
- let left = obj.left ?? 0;
12301
- let top = obj.top ?? 0;
12302
- if (obj instanceof fabric.Group && obj.__cropGroup) {
12303
- left = left - width / 2;
12304
- top = top - height / 2;
12305
- } else if (obj.originX === "center" || obj.originY === "center") {
12306
- const offsetX = obj.originX === "center" ? width / 2 : 0;
12307
- const offsetY = obj.originY === "center" ? height / 2 : 0;
12308
- left = left - offsetX;
12309
- top = top - offsetY;
12284
+ const angle = obj.angle ?? 0;
12285
+ let left;
12286
+ let top;
12287
+ const centerFn = obj.getCenterPoint;
12288
+ if (typeof centerFn === "function") {
12289
+ const c = centerFn.call(obj);
12290
+ left = c.x - width / 2;
12291
+ top = c.y - height / 2;
12292
+ } else {
12293
+ left = obj.left ?? 0;
12294
+ top = obj.top ?? 0;
12295
+ if (obj.originX === "center") left -= width / 2;
12296
+ if (obj.originY === "center") top -= height / 2;
12310
12297
  }
12311
- result.set(id, { left, top, width, height });
12298
+ result.set(id, { left, top, width, height, angle });
12312
12299
  }
12313
12300
  });
12314
12301
  return result;
@@ -17483,6 +17470,17 @@ const PageCanvas = forwardRef(
17483
17470
  const fadeKeyChanged = newFadeKey !== oldFadeKey || newFadeKey !== innerOldKey || cropFadeRendererMissing;
17484
17471
  const needsReload = sourceUrlChanged || colorMapChanged || fadeKeyChanged && !isCropGroup2;
17485
17472
  const needsCropGroupFadeUpdate = isCropGroup2 && fadeKeyChanged;
17473
+ let cropFrameSizeChanged = false;
17474
+ if (isCropGroup2) {
17475
+ const liveCt = existingObj.__cropData;
17476
+ const liveW = Number(liveCt == null ? void 0 : liveCt.frameW) || 0;
17477
+ const liveH = Number(liveCt == null ? void 0 : liveCt.frameH) || 0;
17478
+ const schemaW = (Number(element.width) || 0) * (Number(element.scaleX) || 1);
17479
+ const schemaH = (Number(element.height) || 0) * (Number(element.scaleY) || 1);
17480
+ if (schemaW > 0 && schemaH > 0 && (Math.abs(schemaW - liveW) > 0.5 || Math.abs(schemaH - liveH) > 0.5)) {
17481
+ cropFrameSizeChanged = true;
17482
+ }
17483
+ }
17486
17484
  const hadUrlBefore = storedImageUrl && String(storedImageUrl).trim() !== "";
17487
17485
  if (!hasUrl && hadUrlBefore) {
17488
17486
  const resolvedSizeImg = (pageChildren == null ? void 0 : pageChildren.length) ? getNodeBounds(element, pageChildren) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
@@ -17519,7 +17517,7 @@ const PageCanvas = forwardRef(
17519
17517
  const clipShapeForReplace = element.clipShape ?? ((_g = element.style) == null ? void 0 : _g.imageFrameShape) ?? (isPreviewMode ? "rectangle" : "none");
17520
17518
  const needCropGroupForElement = imageFitForReplace !== "fill" || clipShapeForReplace && clipShapeForReplace !== "none";
17521
17519
  const plainImageNeedsCropGroup = hasUrl && !isCropGroup2 && existingObj instanceof fabric.FabricImage && needCropGroupForElement;
17522
- if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate)) {
17520
+ if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate || cropFrameSizeChanged)) {
17523
17521
  if (needsReload && !isBeingTransformed && (!wasJustModified || sourceUrlChanged)) {
17524
17522
  loadImageAsync2(element, existingObj, fc);
17525
17523
  } else if (plainImageNeedsCropGroup) {
@@ -20458,7 +20456,9 @@ function PreviewCanvas({
20458
20456
  border: isHovered ? "2px solid rgb(59 130 246)" : "none",
20459
20457
  backgroundColor: isHovered ? "rgba(59, 130, 246, 0.1)" : "transparent",
20460
20458
  borderRadius: 4,
20461
- pointerEvents: "auto"
20459
+ pointerEvents: "auto",
20460
+ transform: (bounds == null ? void 0 : bounds.angle) ? `rotate(${bounds.angle}deg)` : void 0,
20461
+ transformOrigin: "center center"
20462
20462
  },
20463
20463
  onMouseEnter: () => setHoveredFieldId(element.id),
20464
20464
  onMouseLeave: () => setHoveredFieldId(null),
@@ -26295,9 +26295,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26295
26295
  }
26296
26296
  return svgString;
26297
26297
  }
26298
- const resolvedPackageVersion = "0.5.467";
26298
+ const resolvedPackageVersion = "0.5.468";
26299
26299
  const PACKAGE_VERSION = resolvedPackageVersion;
26300
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.467";
26300
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.468";
26301
26301
  const roundParityValue = (value) => {
26302
26302
  if (typeof value !== "number") return value;
26303
26303
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27111,7 +27111,7 @@ class PixldocsRenderer {
27111
27111
  await this.waitForCanvasScene(container, cloned, i);
27112
27112
  }
27113
27113
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27114
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-v-hlKrdw.js");
27114
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-C7FmPpVD.js");
27115
27115
  const prepared = preparePagesForExport(
27116
27116
  cloned.pages,
27117
27117
  canvasWidth,
@@ -29431,7 +29431,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29431
29431
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29432
29432
  sanitizeSvgTreeForPdf(svgToDraw);
29433
29433
  try {
29434
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-v-hlKrdw.js");
29434
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-C7FmPpVD.js");
29435
29435
  try {
29436
29436
  await logTextMeasurementDiagnostic(svgToDraw);
29437
29437
  } catch {
@@ -29748,4 +29748,4 @@ export {
29748
29748
  buildTeaserBlurFlatKeys as y,
29749
29749
  collectFontDescriptorsFromConfig as z
29750
29750
  };
29751
- //# sourceMappingURL=index-MX3VJ8nQ.js.map
29751
+ //# sourceMappingURL=index-CGFOtPDx.js.map