@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.cjs CHANGED
@@ -11881,6 +11881,12 @@ function measureLineWidth(obj, line) {
11881
11881
  const charSpacing = Number(obj.charSpacing || 0) / 1e3 * fontSize;
11882
11882
  return ctx.measureText(line).width + Math.max(0, line.length - 1) * charSpacing;
11883
11883
  }
11884
+ function getDecorationPadding(obj) {
11885
+ var _a;
11886
+ const strokeWidth = Number(obj.strokeWidth || 0);
11887
+ const shadowBlur = Number(((_a = obj.shadow) == null ? void 0 : _a.blur) || 0);
11888
+ return Math.max(0, strokeWidth) + Math.max(0, shadowBlur * 0.25);
11889
+ }
11884
11890
  function getFabricCanvasFromContainer(container) {
11885
11891
  const registry2 = window.__fabricCanvasRegistry;
11886
11892
  if (registry2 instanceof Map) {
@@ -11928,8 +11934,8 @@ function stabilizeFabricTextObjects(fabricInstance) {
11928
11934
  (_b2 = obj.set) == null ? void 0 : _b2.call(obj, { width: saved.width, scaleX: saved.scaleX, scaleY: saved.scaleY });
11929
11935
  }
11930
11936
  if (obj.underline || obj.linethrough) {
11931
- const lineWidths = Array.isArray(obj.__lineWidths) ? obj.__lineWidths : [];
11932
- obj.__lineWidths = getTextLines(obj).map((line, index) => Math.max(lineWidths[index] || 0, measureLineWidth(obj, line)));
11937
+ const decorationPadding = getDecorationPadding(obj);
11938
+ obj.__lineWidths = getTextLines(obj).map((line) => Math.max(0, measureLineWidth(obj, line) + decorationPadding));
11933
11939
  }
11934
11940
  obj.dirty = true;
11935
11941
  (_c2 = obj._clearCache) == null ? void 0 : _c2.call(obj);
@@ -12640,7 +12646,6 @@ class PixldocsRenderer {
12640
12646
  pageIndex,
12641
12647
  zoom: pixelRatio,
12642
12648
  absoluteZoom: true,
12643
- skipFontReadyWait: true,
12644
12649
  onReady
12645
12650
  })
12646
12651
  );
@@ -12744,7 +12749,6 @@ class PixldocsRenderer {
12744
12749
  zoom: 1,
12745
12750
  // 1:1 — no UI scaling for SVG capture
12746
12751
  absoluteZoom: true,
12747
- skipFontReadyWait: true,
12748
12752
  onReady
12749
12753
  })
12750
12754
  );