@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.
@@ -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
  }
@@ -10618,6 +10638,30 @@ function runFontReloadAndReflow(opts) {
10618
10638
  } catch {
10619
10639
  }
10620
10640
  }
10641
+ const reinitTextboxesIn = (parent) => {
10642
+ const children = typeof parent.getObjects === "function" ? parent.getObjects() : [];
10643
+ for (const obj of children) {
10644
+ if (obj instanceof fabric__namespace.Textbox) {
10645
+ try {
10646
+ obj.initDimensions();
10647
+ obj.setCoords();
10648
+ obj.dirty = true;
10649
+ } catch {
10650
+ }
10651
+ } else if (obj instanceof fabric__namespace.Group) {
10652
+ reinitTextboxesIn(obj);
10653
+ try {
10654
+ obj.dirty = true;
10655
+ } catch {
10656
+ }
10657
+ }
10658
+ }
10659
+ };
10660
+ try {
10661
+ reinitTextboxesIn(canvas);
10662
+ } catch (e) {
10663
+ console.warn("[canvasReflow] textbox re-wrap failed:", e);
10664
+ }
10621
10665
  if (persistTextboxSize && pageTree.length) {
10622
10666
  const elements = flattenChildren(pageTree);
10623
10667
  canvas.getObjects().forEach((obj) => {
@@ -26327,9 +26371,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26327
26371
  }
26328
26372
  return svgString;
26329
26373
  }
26330
- const resolvedPackageVersion = "0.5.473";
26374
+ const resolvedPackageVersion = "0.5.475";
26331
26375
  const PACKAGE_VERSION = resolvedPackageVersion;
26332
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.473";
26376
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.475";
26333
26377
  const roundParityValue = (value) => {
26334
26378
  if (typeof value !== "number") return value;
26335
26379
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27143,7 +27187,7 @@ class PixldocsRenderer {
27143
27187
  await this.waitForCanvasScene(container, cloned, i);
27144
27188
  }
27145
27189
  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"));
27190
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-omFy2Jbf.cjs"));
27147
27191
  const prepared = preparePagesForExport(
27148
27192
  cloned.pages,
27149
27193
  canvasWidth,
@@ -29463,7 +29507,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29463
29507
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29464
29508
  sanitizeSvgTreeForPdf(svgToDraw);
29465
29509
  try {
29466
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DMy-gCf7.cjs"));
29510
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-omFy2Jbf.cjs"));
29467
29511
  try {
29468
29512
  await logTextMeasurementDiagnostic(svgToDraw);
29469
29513
  } catch {
@@ -29777,4 +29821,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29777
29821
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29778
29822
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29779
29823
  exports.warmTemplateFromForm = warmTemplateFromForm;
29780
- //# sourceMappingURL=index-ruS86aJe.cjs.map
29824
+ //# sourceMappingURL=index-CkJuu8qW.cjs.map