@pixldocs/canvas-renderer 0.5.465 → 0.5.467

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,6 +5237,22 @@ 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
+ }
5240
5256
  finalizeCropGroupCoords(g);
5241
5257
  if (g.canvas) {
5242
5258
  g.setCoords();
@@ -17467,17 +17483,6 @@ const PageCanvas = forwardRef(
17467
17483
  const fadeKeyChanged = newFadeKey !== oldFadeKey || newFadeKey !== innerOldKey || cropFadeRendererMissing;
17468
17484
  const needsReload = sourceUrlChanged || colorMapChanged || fadeKeyChanged && !isCropGroup2;
17469
17485
  const needsCropGroupFadeUpdate = isCropGroup2 && fadeKeyChanged;
17470
- let cropFrameSizeChanged = false;
17471
- if (isCropGroup2) {
17472
- const liveCt = existingObj.__cropData;
17473
- const liveW = Number(liveCt == null ? void 0 : liveCt.frameW) || 0;
17474
- const liveH = Number(liveCt == null ? void 0 : liveCt.frameH) || 0;
17475
- const schemaW = (Number(element.width) || 0) * (Number(element.scaleX) || 1);
17476
- const schemaH = (Number(element.height) || 0) * (Number(element.scaleY) || 1);
17477
- if (schemaW > 0 && schemaH > 0 && (Math.abs(schemaW - liveW) > 0.5 || Math.abs(schemaH - liveH) > 0.5)) {
17478
- cropFrameSizeChanged = true;
17479
- }
17480
- }
17481
17486
  const hadUrlBefore = storedImageUrl && String(storedImageUrl).trim() !== "";
17482
17487
  if (!hasUrl && hadUrlBefore) {
17483
17488
  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 };
@@ -17514,7 +17519,7 @@ const PageCanvas = forwardRef(
17514
17519
  const clipShapeForReplace = element.clipShape ?? ((_g = element.style) == null ? void 0 : _g.imageFrameShape) ?? (isPreviewMode ? "rectangle" : "none");
17515
17520
  const needCropGroupForElement = imageFitForReplace !== "fill" || clipShapeForReplace && clipShapeForReplace !== "none";
17516
17521
  const plainImageNeedsCropGroup = hasUrl && !isCropGroup2 && existingObj instanceof fabric.FabricImage && needCropGroupForElement;
17517
- if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate || cropFrameSizeChanged)) {
17522
+ if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate)) {
17518
17523
  if (needsReload && !isBeingTransformed && (!wasJustModified || sourceUrlChanged)) {
17519
17524
  loadImageAsync2(element, existingObj, fc);
17520
17525
  } else if (plainImageNeedsCropGroup) {
@@ -26290,9 +26295,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26290
26295
  }
26291
26296
  return svgString;
26292
26297
  }
26293
- const resolvedPackageVersion = "0.5.465";
26298
+ const resolvedPackageVersion = "0.5.467";
26294
26299
  const PACKAGE_VERSION = resolvedPackageVersion;
26295
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.465";
26300
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.467";
26296
26301
  const roundParityValue = (value) => {
26297
26302
  if (typeof value !== "number") return value;
26298
26303
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27106,7 +27111,7 @@ class PixldocsRenderer {
27106
27111
  await this.waitForCanvasScene(container, cloned, i);
27107
27112
  }
27108
27113
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27109
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CVeVbCo7.js");
27114
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-v-hlKrdw.js");
27110
27115
  const prepared = preparePagesForExport(
27111
27116
  cloned.pages,
27112
27117
  canvasWidth,
@@ -29426,7 +29431,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29426
29431
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29427
29432
  sanitizeSvgTreeForPdf(svgToDraw);
29428
29433
  try {
29429
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CVeVbCo7.js");
29434
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-v-hlKrdw.js");
29430
29435
  try {
29431
29436
  await logTextMeasurementDiagnostic(svgToDraw);
29432
29437
  } catch {
@@ -29743,4 +29748,4 @@ export {
29743
29748
  buildTeaserBlurFlatKeys as y,
29744
29749
  collectFontDescriptorsFromConfig as z
29745
29750
  };
29746
- //# sourceMappingURL=index-DmkAdvKz.js.map
29751
+ //# sourceMappingURL=index-MX3VJ8nQ.js.map