@pixldocs/canvas-renderer 0.5.473 → 0.5.474

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.
@@ -8530,6 +8530,25 @@ function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
8530
8530
  if (tl > 0) ctx.quadraticCurveTo(x, y, x + tl, y);
8531
8531
  ctx.closePath();
8532
8532
  }
8533
+ function buildRoundedRectPath2DObject(x, y, w, h, rTL, rTR, rBR, rBL) {
8534
+ const maxR = Math.min(w, h) / 2;
8535
+ const tl = Math.min(Math.max(0, rTL), maxR);
8536
+ const tr = Math.min(Math.max(0, rTR), maxR);
8537
+ const br = Math.min(Math.max(0, rBR), maxR);
8538
+ const bl = Math.min(Math.max(0, rBL), maxR);
8539
+ const p = new Path2D();
8540
+ p.moveTo(x + tl, y);
8541
+ p.lineTo(x + w - tr, y);
8542
+ if (tr > 0) p.quadraticCurveTo(x + w, y, x + w, y + tr);
8543
+ p.lineTo(x + w, y + h - br);
8544
+ if (br > 0) p.quadraticCurveTo(x + w, y + h, x + w - br, y + h);
8545
+ p.lineTo(x + bl, y + h);
8546
+ if (bl > 0) p.quadraticCurveTo(x, y + h, x, y + h - bl);
8547
+ p.lineTo(x, y + tl);
8548
+ if (tl > 0) p.quadraticCurveTo(x, y, x + tl, y);
8549
+ p.closePath();
8550
+ return p;
8551
+ }
8533
8552
  function measureLineGlyphWidth(obj, lineIndex) {
8534
8553
  var _a2, _b2, _c2, _d, _e, _f;
8535
8554
  try {
@@ -8717,9 +8736,9 @@ function applyTextBackground(obj, cfg) {
8717
8736
  ctx.transform(1, shearTransform.slope, 0, 1, 0, shearTransform.dy);
8718
8737
  }
8719
8738
  const rects = bgRectsForFill;
8739
+ const combined = new Path2D();
8720
8740
  for (const r of rects) {
8721
- buildRoundedRectPath2D(
8722
- ctx,
8741
+ const sub = buildRoundedRectPath2DObject(
8723
8742
  r.x,
8724
8743
  r.y,
8725
8744
  r.w,
@@ -8729,8 +8748,9 @@ function applyTextBackground(obj, cfg) {
8729
8748
  bg.rxBR ?? 0,
8730
8749
  bg.rxBL ?? 0
8731
8750
  );
8732
- ctx.fill();
8751
+ combined.addPath(sub);
8733
8752
  }
8753
+ ctx.fill(combined);
8734
8754
  }
8735
8755
  ctx.restore();
8736
8756
  }
@@ -26309,9 +26329,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26309
26329
  }
26310
26330
  return svgString;
26311
26331
  }
26312
- const resolvedPackageVersion = "0.5.473";
26332
+ const resolvedPackageVersion = "0.5.474";
26313
26333
  const PACKAGE_VERSION = resolvedPackageVersion;
26314
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.473";
26334
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.474";
26315
26335
  const roundParityValue = (value) => {
26316
26336
  if (typeof value !== "number") return value;
26317
26337
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27125,7 +27145,7 @@ class PixldocsRenderer {
27125
27145
  await this.waitForCanvasScene(container, cloned, i);
27126
27146
  }
27127
27147
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27128
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CJgFbOQ5.js");
27148
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-auFctmty.js");
27129
27149
  const prepared = preparePagesForExport(
27130
27150
  cloned.pages,
27131
27151
  canvasWidth,
@@ -29445,7 +29465,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29445
29465
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29446
29466
  sanitizeSvgTreeForPdf(svgToDraw);
29447
29467
  try {
29448
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CJgFbOQ5.js");
29468
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-auFctmty.js");
29449
29469
  try {
29450
29470
  await logTextMeasurementDiagnostic(svgToDraw);
29451
29471
  } catch {
@@ -29762,4 +29782,4 @@ export {
29762
29782
  buildTeaserBlurFlatKeys as y,
29763
29783
  collectFontDescriptorsFromConfig as z
29764
29784
  };
29765
- //# sourceMappingURL=index-DI9QBo4-.js.map
29785
+ //# sourceMappingURL=index-DsthQYTx.js.map