@pixldocs/canvas-renderer 0.5.37 → 0.5.38

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
@@ -12073,10 +12073,42 @@ function PixldocsPreview(props) {
12073
12073
  ] });
12074
12074
  }
12075
12075
  const PACKAGE_VERSION = "0.5.37";
12076
+ let __underlineFixInstalled = false;
12077
+ function installUnderlineFix(fab) {
12078
+ var _a;
12079
+ if (__underlineFixInstalled) return;
12080
+ const TextProto = (_a = fab.Text) == null ? void 0 : _a.prototype;
12081
+ if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
12082
+ const original = TextProto._renderTextDecoration;
12083
+ TextProto._renderTextDecoration = function patchedRenderTextDecoration(ctx, type) {
12084
+ try {
12085
+ const hasOwn = !!this[type];
12086
+ const hasStyled = typeof this.styleHas === "function" && this.styleHas(type);
12087
+ if (!hasOwn && !hasStyled) {
12088
+ return original.call(this, ctx, type);
12089
+ }
12090
+ const lines = this._textLines;
12091
+ if (Array.isArray(lines)) {
12092
+ this.__charBounds = [];
12093
+ for (let i = 0; i < lines.length; i++) {
12094
+ try {
12095
+ this.getLineWidth(i);
12096
+ } catch {
12097
+ }
12098
+ }
12099
+ }
12100
+ } catch {
12101
+ }
12102
+ return original.call(this, ctx, type);
12103
+ };
12104
+ __underlineFixInstalled = true;
12105
+ console.log(`[canvas-renderer] underline-fix monkey patch installed (v${PACKAGE_VERSION})`);
12106
+ }
12076
12107
  class PixldocsRenderer {
12077
12108
  constructor(config) {
12078
12109
  __publicField(this, "config");
12079
12110
  this.config = config;
12111
+ installUnderlineFix(fabric__namespace);
12080
12112
  try {
12081
12113
  console.log(`[canvas-renderer] PixldocsRenderer v${PACKAGE_VERSION} initialized`);
12082
12114
  } catch {