@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.
@@ -8548,6 +8548,25 @@ function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
8548
8548
  if (tl > 0) ctx.quadraticCurveTo(x, y, x + tl, y);
8549
8549
  ctx.closePath();
8550
8550
  }
8551
+ function buildRoundedRectPath2DObject(x, y, w, h, rTL, rTR, rBR, rBL) {
8552
+ const maxR = Math.min(w, h) / 2;
8553
+ const tl = Math.min(Math.max(0, rTL), maxR);
8554
+ const tr = Math.min(Math.max(0, rTR), maxR);
8555
+ const br = Math.min(Math.max(0, rBR), maxR);
8556
+ const bl = Math.min(Math.max(0, rBL), maxR);
8557
+ const p = new Path2D();
8558
+ p.moveTo(x + tl, y);
8559
+ p.lineTo(x + w - tr, y);
8560
+ if (tr > 0) p.quadraticCurveTo(x + w, y, x + w, y + tr);
8561
+ p.lineTo(x + w, y + h - br);
8562
+ if (br > 0) p.quadraticCurveTo(x + w, y + h, x + w - br, y + h);
8563
+ p.lineTo(x + bl, y + h);
8564
+ if (bl > 0) p.quadraticCurveTo(x, y + h, x, y + h - bl);
8565
+ p.lineTo(x, y + tl);
8566
+ if (tl > 0) p.quadraticCurveTo(x, y, x + tl, y);
8567
+ p.closePath();
8568
+ return p;
8569
+ }
8551
8570
  function measureLineGlyphWidth(obj, lineIndex) {
8552
8571
  var _a2, _b2, _c2, _d, _e, _f;
8553
8572
  try {
@@ -8735,9 +8754,9 @@ function applyTextBackground(obj, cfg) {
8735
8754
  ctx.transform(1, shearTransform.slope, 0, 1, 0, shearTransform.dy);
8736
8755
  }
8737
8756
  const rects = bgRectsForFill;
8757
+ const combined = new Path2D();
8738
8758
  for (const r of rects) {
8739
- buildRoundedRectPath2D(
8740
- ctx,
8759
+ const sub = buildRoundedRectPath2DObject(
8741
8760
  r.x,
8742
8761
  r.y,
8743
8762
  r.w,
@@ -8747,8 +8766,9 @@ function applyTextBackground(obj, cfg) {
8747
8766
  bg.rxBR ?? 0,
8748
8767
  bg.rxBL ?? 0
8749
8768
  );
8750
- ctx.fill();
8769
+ combined.addPath(sub);
8751
8770
  }
8771
+ ctx.fill(combined);
8752
8772
  }
8753
8773
  ctx.restore();
8754
8774
  }
@@ -26327,9 +26347,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26327
26347
  }
26328
26348
  return svgString;
26329
26349
  }
26330
- const resolvedPackageVersion = "0.5.473";
26350
+ const resolvedPackageVersion = "0.5.474";
26331
26351
  const PACKAGE_VERSION = resolvedPackageVersion;
26332
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.473";
26352
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.474";
26333
26353
  const roundParityValue = (value) => {
26334
26354
  if (typeof value !== "number") return value;
26335
26355
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27143,7 +27163,7 @@ class PixldocsRenderer {
27143
27163
  await this.waitForCanvasScene(container, cloned, i);
27144
27164
  }
27145
27165
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27146
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DMy-gCf7.cjs"));
27166
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Cgw2jQ1F.cjs"));
27147
27167
  const prepared = preparePagesForExport(
27148
27168
  cloned.pages,
27149
27169
  canvasWidth,
@@ -29463,7 +29483,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29463
29483
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29464
29484
  sanitizeSvgTreeForPdf(svgToDraw);
29465
29485
  try {
29466
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DMy-gCf7.cjs"));
29486
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Cgw2jQ1F.cjs"));
29467
29487
  try {
29468
29488
  await logTextMeasurementDiagnostic(svgToDraw);
29469
29489
  } catch {
@@ -29777,4 +29797,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29777
29797
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29778
29798
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29779
29799
  exports.warmTemplateFromForm = warmTemplateFromForm;
29780
- //# sourceMappingURL=index-ruS86aJe.cjs.map
29800
+ //# sourceMappingURL=index-D2hncOO0.cjs.map