@pixldocs/canvas-renderer 0.5.20 → 0.5.21

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.
package/dist/index.js CHANGED
@@ -11862,6 +11862,12 @@ function measureLineWidth(obj, line) {
11862
11862
  const charSpacing = Number(obj.charSpacing || 0) / 1e3 * fontSize;
11863
11863
  return ctx.measureText(line).width + Math.max(0, line.length - 1) * charSpacing;
11864
11864
  }
11865
+ function getDecorationPadding(obj) {
11866
+ var _a;
11867
+ const strokeWidth = Number(obj.strokeWidth || 0);
11868
+ const shadowBlur = Number(((_a = obj.shadow) == null ? void 0 : _a.blur) || 0);
11869
+ return Math.max(0, strokeWidth) + Math.max(0, shadowBlur * 0.25);
11870
+ }
11865
11871
  function getFabricCanvasFromContainer(container) {
11866
11872
  const registry2 = window.__fabricCanvasRegistry;
11867
11873
  if (registry2 instanceof Map) {
@@ -11909,8 +11915,8 @@ function stabilizeFabricTextObjects(fabricInstance) {
11909
11915
  (_b2 = obj.set) == null ? void 0 : _b2.call(obj, { width: saved.width, scaleX: saved.scaleX, scaleY: saved.scaleY });
11910
11916
  }
11911
11917
  if (obj.underline || obj.linethrough) {
11912
- const lineWidths = Array.isArray(obj.__lineWidths) ? obj.__lineWidths : [];
11913
- obj.__lineWidths = getTextLines(obj).map((line, index) => Math.max(lineWidths[index] || 0, measureLineWidth(obj, line)));
11918
+ const decorationPadding = getDecorationPadding(obj);
11919
+ obj.__lineWidths = getTextLines(obj).map((line) => Math.max(0, measureLineWidth(obj, line) + decorationPadding));
11914
11920
  }
11915
11921
  obj.dirty = true;
11916
11922
  (_c2 = obj._clearCache) == null ? void 0 : _c2.call(obj);
@@ -12621,7 +12627,6 @@ class PixldocsRenderer {
12621
12627
  pageIndex,
12622
12628
  zoom: pixelRatio,
12623
12629
  absoluteZoom: true,
12624
- skipFontReadyWait: true,
12625
12630
  onReady
12626
12631
  })
12627
12632
  );
@@ -12725,7 +12730,6 @@ class PixldocsRenderer {
12725
12730
  zoom: 1,
12726
12731
  // 1:1 — no UI scaling for SVG capture
12727
12732
  absoluteZoom: true,
12728
- skipFontReadyWait: true,
12729
12733
  onReady
12730
12734
  })
12731
12735
  );