@pixldocs/canvas-renderer 0.5.34 → 0.5.36
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 +21 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12722,15 +12722,30 @@ class PixldocsRenderer {
|
|
|
12722
12722
|
const fabricInstance = this.getFabricCanvasFromContainer(container);
|
|
12723
12723
|
if (!(fabricInstance == null ? void 0 : fabricInstance.getObjects)) return;
|
|
12724
12724
|
const waitForPaint = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
|
|
12725
|
-
const
|
|
12726
|
-
|
|
12727
|
-
|
|
12725
|
+
const primeCharBounds = (obj) => {
|
|
12726
|
+
if (obj instanceof fabric.Textbox) {
|
|
12727
|
+
const lines = obj._textLines;
|
|
12728
|
+
if (Array.isArray(lines)) {
|
|
12729
|
+
for (let i = 0; i < lines.length; i++) {
|
|
12730
|
+
try {
|
|
12731
|
+
obj.getLineWidth(i);
|
|
12732
|
+
} catch {
|
|
12733
|
+
}
|
|
12734
|
+
}
|
|
12735
|
+
}
|
|
12736
|
+
obj.dirty = true;
|
|
12737
|
+
return;
|
|
12738
|
+
}
|
|
12739
|
+
if (obj instanceof fabric.Group) {
|
|
12740
|
+
obj.getObjects().forEach(primeCharBounds);
|
|
12741
|
+
obj.dirty = true;
|
|
12742
|
+
}
|
|
12728
12743
|
};
|
|
12729
|
-
|
|
12730
|
-
await waitForPaint();
|
|
12744
|
+
fabricInstance.getObjects().forEach(primeCharBounds);
|
|
12731
12745
|
(_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
|
|
12732
12746
|
(_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
|
|
12733
|
-
|
|
12747
|
+
await waitForPaint();
|
|
12748
|
+
(_c = fabricInstance.renderAll) == null ? void 0 : _c.call(fabricInstance);
|
|
12734
12749
|
await waitForPaint();
|
|
12735
12750
|
}
|
|
12736
12751
|
}
|