@pixldocs/canvas-renderer 0.5.34 → 0.5.35
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 +25 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12745,8 +12745,33 @@ class PixldocsRenderer {
|
|
|
12745
12745
|
clearFabricCharCache();
|
|
12746
12746
|
clearMeasurementCache();
|
|
12747
12747
|
};
|
|
12748
|
+
const resyncTextboxWidths = (obj) => {
|
|
12749
|
+
if (obj instanceof fabric__namespace.Textbox) {
|
|
12750
|
+
const savedWidth = Math.max(1, obj.width ?? 0);
|
|
12751
|
+
const savedScaleX = obj.scaleX ?? 1;
|
|
12752
|
+
const savedScaleY = obj.scaleY ?? 1;
|
|
12753
|
+
obj.initDimensions();
|
|
12754
|
+
if (Math.abs((obj.width ?? 0) - savedWidth) > 0.01) {
|
|
12755
|
+
obj.width = savedWidth;
|
|
12756
|
+
}
|
|
12757
|
+
if (Math.abs((obj.scaleX ?? 1) - savedScaleX) > 0.01) {
|
|
12758
|
+
obj.scaleX = savedScaleX;
|
|
12759
|
+
}
|
|
12760
|
+
if (Math.abs((obj.scaleY ?? 1) - savedScaleY) > 0.01) {
|
|
12761
|
+
obj.scaleY = savedScaleY;
|
|
12762
|
+
}
|
|
12763
|
+
obj.setCoords();
|
|
12764
|
+
obj.dirty = true;
|
|
12765
|
+
return;
|
|
12766
|
+
}
|
|
12767
|
+
if (obj instanceof fabric__namespace.Group) {
|
|
12768
|
+
obj.getObjects().forEach(resyncTextboxWidths);
|
|
12769
|
+
obj.dirty = true;
|
|
12770
|
+
}
|
|
12771
|
+
};
|
|
12748
12772
|
clearTextMetricCaches();
|
|
12749
12773
|
await waitForPaint();
|
|
12774
|
+
fabricInstance.getObjects().forEach(resyncTextboxWidths);
|
|
12750
12775
|
(_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
|
|
12751
12776
|
(_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
|
|
12752
12777
|
(_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);
|