@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 +32 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12054,10 +12054,42 @@ function PixldocsPreview(props) {
|
|
|
12054
12054
|
] });
|
|
12055
12055
|
}
|
|
12056
12056
|
const PACKAGE_VERSION = "0.5.37";
|
|
12057
|
+
let __underlineFixInstalled = false;
|
|
12058
|
+
function installUnderlineFix(fab) {
|
|
12059
|
+
var _a;
|
|
12060
|
+
if (__underlineFixInstalled) return;
|
|
12061
|
+
const TextProto = (_a = fab.Text) == null ? void 0 : _a.prototype;
|
|
12062
|
+
if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
|
|
12063
|
+
const original = TextProto._renderTextDecoration;
|
|
12064
|
+
TextProto._renderTextDecoration = function patchedRenderTextDecoration(ctx, type) {
|
|
12065
|
+
try {
|
|
12066
|
+
const hasOwn = !!this[type];
|
|
12067
|
+
const hasStyled = typeof this.styleHas === "function" && this.styleHas(type);
|
|
12068
|
+
if (!hasOwn && !hasStyled) {
|
|
12069
|
+
return original.call(this, ctx, type);
|
|
12070
|
+
}
|
|
12071
|
+
const lines = this._textLines;
|
|
12072
|
+
if (Array.isArray(lines)) {
|
|
12073
|
+
this.__charBounds = [];
|
|
12074
|
+
for (let i = 0; i < lines.length; i++) {
|
|
12075
|
+
try {
|
|
12076
|
+
this.getLineWidth(i);
|
|
12077
|
+
} catch {
|
|
12078
|
+
}
|
|
12079
|
+
}
|
|
12080
|
+
}
|
|
12081
|
+
} catch {
|
|
12082
|
+
}
|
|
12083
|
+
return original.call(this, ctx, type);
|
|
12084
|
+
};
|
|
12085
|
+
__underlineFixInstalled = true;
|
|
12086
|
+
console.log(`[canvas-renderer] underline-fix monkey patch installed (v${PACKAGE_VERSION})`);
|
|
12087
|
+
}
|
|
12057
12088
|
class PixldocsRenderer {
|
|
12058
12089
|
constructor(config) {
|
|
12059
12090
|
__publicField(this, "config");
|
|
12060
12091
|
this.config = config;
|
|
12092
|
+
installUnderlineFix(fabric);
|
|
12061
12093
|
try {
|
|
12062
12094
|
console.log(`[canvas-renderer] PixldocsRenderer v${PACKAGE_VERSION} initialized`);
|
|
12063
12095
|
} catch {
|