@pixldocs/canvas-renderer 0.4.3 → 0.4.4
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 +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2558,13 +2558,23 @@ const clearFabricCharCache = () => {
|
|
|
2558
2558
|
};
|
|
2559
2559
|
const clearFontCacheAndRerender = (canvas) => {
|
|
2560
2560
|
clearFabricCharCache();
|
|
2561
|
-
|
|
2561
|
+
const fixTextbox = (obj) => {
|
|
2562
|
+
var _a;
|
|
2562
2563
|
if (obj instanceof fabric.Textbox) {
|
|
2564
|
+
const savedWidth = obj.width;
|
|
2563
2565
|
obj.dirty = true;
|
|
2564
2566
|
obj.initDimensions();
|
|
2567
|
+
if (savedWidth != null && Math.abs((obj.width ?? 0) - savedWidth) > 0.01) {
|
|
2568
|
+
obj.width = savedWidth;
|
|
2569
|
+
}
|
|
2570
|
+
obj.setCoords();
|
|
2571
|
+
} else if (obj instanceof fabric.Group) {
|
|
2572
|
+
(_a = obj._objects) == null ? void 0 : _a.forEach(fixTextbox);
|
|
2573
|
+
obj.dirty = true;
|
|
2565
2574
|
obj.setCoords();
|
|
2566
2575
|
}
|
|
2567
|
-
}
|
|
2576
|
+
};
|
|
2577
|
+
canvas.getObjects().forEach(fixTextbox);
|
|
2568
2578
|
canvas.requestRenderAll();
|
|
2569
2579
|
};
|
|
2570
2580
|
const ensureFontLoaded = async (fontFamily) => {
|