@pixldocs/canvas-renderer 0.5.473 → 0.5.475

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
  }
@@ -10600,6 +10620,30 @@ function runFontReloadAndReflow(opts) {
10600
10620
  } catch {
10601
10621
  }
10602
10622
  }
10623
+ const reinitTextboxesIn = (parent) => {
10624
+ const children = typeof parent.getObjects === "function" ? parent.getObjects() : [];
10625
+ for (const obj of children) {
10626
+ if (obj instanceof fabric.Textbox) {
10627
+ try {
10628
+ obj.initDimensions();
10629
+ obj.setCoords();
10630
+ obj.dirty = true;
10631
+ } catch {
10632
+ }
10633
+ } else if (obj instanceof fabric.Group) {
10634
+ reinitTextboxesIn(obj);
10635
+ try {
10636
+ obj.dirty = true;
10637
+ } catch {
10638
+ }
10639
+ }
10640
+ }
10641
+ };
10642
+ try {
10643
+ reinitTextboxesIn(canvas);
10644
+ } catch (e) {
10645
+ console.warn("[canvasReflow] textbox re-wrap failed:", e);
10646
+ }
10603
10647
  if (persistTextboxSize && pageTree.length) {
10604
10648
  const elements = flattenChildren(pageTree);
10605
10649
  canvas.getObjects().forEach((obj) => {
@@ -26309,9 +26353,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26309
26353
  }
26310
26354
  return svgString;
26311
26355
  }
26312
- const resolvedPackageVersion = "0.5.473";
26356
+ const resolvedPackageVersion = "0.5.475";
26313
26357
  const PACKAGE_VERSION = resolvedPackageVersion;
26314
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.473";
26358
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.475";
26315
26359
  const roundParityValue = (value) => {
26316
26360
  if (typeof value !== "number") return value;
26317
26361
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27125,7 +27169,7 @@ class PixldocsRenderer {
27125
27169
  await this.waitForCanvasScene(container, cloned, i);
27126
27170
  }
27127
27171
  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");
27172
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-D-qCq8K7.js");
27129
27173
  const prepared = preparePagesForExport(
27130
27174
  cloned.pages,
27131
27175
  canvasWidth,
@@ -29445,7 +29489,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29445
29489
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29446
29490
  sanitizeSvgTreeForPdf(svgToDraw);
29447
29491
  try {
29448
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CJgFbOQ5.js");
29492
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-D-qCq8K7.js");
29449
29493
  try {
29450
29494
  await logTextMeasurementDiagnostic(svgToDraw);
29451
29495
  } catch {
@@ -29762,4 +29806,4 @@ export {
29762
29806
  buildTeaserBlurFlatKeys as y,
29763
29807
  collectFontDescriptorsFromConfig as z
29764
29808
  };
29765
- //# sourceMappingURL=index-DI9QBo4-.js.map
29809
+ //# sourceMappingURL=index-xlEraJ8g.js.map