@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.
@@ -5255,6 +5255,22 @@ function updateCoverLayout(g) {
5255
5255
  if (g.clipPath) {
5256
5256
  g.clipPath.dirty = true;
5257
5257
  }
5258
+ if (fitContain && g.clipPath) {
5259
+ const clip = g.clipPath;
5260
+ const isSpecialMask = isSvgMaskClipPath(clip) || isLuminanceMaskClipPath(clip) || clip.__svgMask || clip.__edgeFadeMask;
5261
+ if (!isSpecialMask) {
5262
+ const clipW = Math.max(frameW, dispW);
5263
+ const clipH = Math.max(frameH, dispH);
5264
+ if (clip instanceof fabric__namespace.Rect) {
5265
+ const rxRatioCt = Number(ct.rx) || 0;
5266
+ 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));
5267
+ clip.set({ width: clipW, height: clipH, rx: rxPx, ry: rxPx, left: offsetX, top: offsetY });
5268
+ } else if (clip instanceof fabric__namespace.Ellipse) {
5269
+ clip.set({ rx: clipW / 2, ry: clipH / 2, left: offsetX, top: offsetY });
5270
+ }
5271
+ clip.dirty = true;
5272
+ }
5273
+ }
5258
5274
  finalizeCropGroupCoords(g);
5259
5275
  if (g.canvas) {
5260
5276
  g.setCoords();
@@ -17485,17 +17501,6 @@ const PageCanvas = react.forwardRef(
17485
17501
  const fadeKeyChanged = newFadeKey !== oldFadeKey || newFadeKey !== innerOldKey || cropFadeRendererMissing;
17486
17502
  const needsReload = sourceUrlChanged || colorMapChanged || fadeKeyChanged && !isCropGroup2;
17487
17503
  const needsCropGroupFadeUpdate = isCropGroup2 && fadeKeyChanged;
17488
- let cropFrameSizeChanged = false;
17489
- if (isCropGroup2) {
17490
- const liveCt = existingObj.__cropData;
17491
- const liveW = Number(liveCt == null ? void 0 : liveCt.frameW) || 0;
17492
- const liveH = Number(liveCt == null ? void 0 : liveCt.frameH) || 0;
17493
- const schemaW = (Number(element.width) || 0) * (Number(element.scaleX) || 1);
17494
- const schemaH = (Number(element.height) || 0) * (Number(element.scaleY) || 1);
17495
- if (schemaW > 0 && schemaH > 0 && (Math.abs(schemaW - liveW) > 0.5 || Math.abs(schemaH - liveH) > 0.5)) {
17496
- cropFrameSizeChanged = true;
17497
- }
17498
- }
17499
17504
  const hadUrlBefore = storedImageUrl && String(storedImageUrl).trim() !== "";
17500
17505
  if (!hasUrl && hadUrlBefore) {
17501
17506
  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 };
@@ -17532,7 +17537,7 @@ const PageCanvas = react.forwardRef(
17532
17537
  const clipShapeForReplace = element.clipShape ?? ((_g = element.style) == null ? void 0 : _g.imageFrameShape) ?? (isPreviewMode ? "rectangle" : "none");
17533
17538
  const needCropGroupForElement = imageFitForReplace !== "fill" || clipShapeForReplace && clipShapeForReplace !== "none";
17534
17539
  const plainImageNeedsCropGroup = hasUrl && !isCropGroup2 && existingObj instanceof fabric__namespace.FabricImage && needCropGroupForElement;
17535
- if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate || cropFrameSizeChanged)) {
17540
+ if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate)) {
17536
17541
  if (needsReload && !isBeingTransformed && (!wasJustModified || sourceUrlChanged)) {
17537
17542
  loadImageAsync2(element, existingObj, fc);
17538
17543
  } else if (plainImageNeedsCropGroup) {
@@ -26308,9 +26313,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26308
26313
  }
26309
26314
  return svgString;
26310
26315
  }
26311
- const resolvedPackageVersion = "0.5.465";
26316
+ const resolvedPackageVersion = "0.5.467";
26312
26317
  const PACKAGE_VERSION = resolvedPackageVersion;
26313
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.465";
26318
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.467";
26314
26319
  const roundParityValue = (value) => {
26315
26320
  if (typeof value !== "number") return value;
26316
26321
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27124,7 +27129,7 @@ class PixldocsRenderer {
27124
27129
  await this.waitForCanvasScene(container, cloned, i);
27125
27130
  }
27126
27131
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27127
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Bsd1V19b.cjs"));
27132
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CYxG1Qy-.cjs"));
27128
27133
  const prepared = preparePagesForExport(
27129
27134
  cloned.pages,
27130
27135
  canvasWidth,
@@ -29444,7 +29449,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29444
29449
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29445
29450
  sanitizeSvgTreeForPdf(svgToDraw);
29446
29451
  try {
29447
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Bsd1V19b.cjs"));
29452
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CYxG1Qy-.cjs"));
29448
29453
  try {
29449
29454
  await logTextMeasurementDiagnostic(svgToDraw);
29450
29455
  } catch {
@@ -29758,4 +29763,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29758
29763
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29759
29764
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29760
29765
  exports.warmTemplateFromForm = warmTemplateFromForm;
29761
- //# sourceMappingURL=index-Co301SkV.cjs.map
29766
+ //# sourceMappingURL=index-JJbf0DOF.cjs.map