@pixldocs/canvas-renderer 0.5.35 → 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 +13 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12741,40 +12741,30 @@ class PixldocsRenderer {
|
|
|
12741
12741
|
const fabricInstance = this.getFabricCanvasFromContainer(container);
|
|
12742
12742
|
if (!(fabricInstance == null ? void 0 : fabricInstance.getObjects)) return;
|
|
12743
12743
|
const waitForPaint = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
|
|
12744
|
-
const
|
|
12745
|
-
clearFabricCharCache();
|
|
12746
|
-
clearMeasurementCache();
|
|
12747
|
-
};
|
|
12748
|
-
const resyncTextboxWidths = (obj) => {
|
|
12744
|
+
const primeCharBounds = (obj) => {
|
|
12749
12745
|
if (obj instanceof fabric__namespace.Textbox) {
|
|
12750
|
-
const
|
|
12751
|
-
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
obj.scaleX = savedScaleX;
|
|
12759
|
-
}
|
|
12760
|
-
if (Math.abs((obj.scaleY ?? 1) - savedScaleY) > 0.01) {
|
|
12761
|
-
obj.scaleY = savedScaleY;
|
|
12746
|
+
const lines = obj._textLines;
|
|
12747
|
+
if (Array.isArray(lines)) {
|
|
12748
|
+
for (let i = 0; i < lines.length; i++) {
|
|
12749
|
+
try {
|
|
12750
|
+
obj.getLineWidth(i);
|
|
12751
|
+
} catch {
|
|
12752
|
+
}
|
|
12753
|
+
}
|
|
12762
12754
|
}
|
|
12763
|
-
obj.setCoords();
|
|
12764
12755
|
obj.dirty = true;
|
|
12765
12756
|
return;
|
|
12766
12757
|
}
|
|
12767
12758
|
if (obj instanceof fabric__namespace.Group) {
|
|
12768
|
-
obj.getObjects().forEach(
|
|
12759
|
+
obj.getObjects().forEach(primeCharBounds);
|
|
12769
12760
|
obj.dirty = true;
|
|
12770
12761
|
}
|
|
12771
12762
|
};
|
|
12772
|
-
|
|
12773
|
-
await waitForPaint();
|
|
12774
|
-
fabricInstance.getObjects().forEach(resyncTextboxWidths);
|
|
12763
|
+
fabricInstance.getObjects().forEach(primeCharBounds);
|
|
12775
12764
|
(_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
|
|
12776
12765
|
(_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
|
|
12777
|
-
|
|
12766
|
+
await waitForPaint();
|
|
12767
|
+
(_c = fabricInstance.renderAll) == null ? void 0 : _c.call(fabricInstance);
|
|
12778
12768
|
await waitForPaint();
|
|
12779
12769
|
}
|
|
12780
12770
|
}
|