@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.js CHANGED
@@ -12726,8 +12726,33 @@ class PixldocsRenderer {
12726
12726
  clearFabricCharCache();
12727
12727
  clearMeasurementCache();
12728
12728
  };
12729
+ const resyncTextboxWidths = (obj) => {
12730
+ if (obj instanceof fabric.Textbox) {
12731
+ const savedWidth = Math.max(1, obj.width ?? 0);
12732
+ const savedScaleX = obj.scaleX ?? 1;
12733
+ const savedScaleY = obj.scaleY ?? 1;
12734
+ obj.initDimensions();
12735
+ if (Math.abs((obj.width ?? 0) - savedWidth) > 0.01) {
12736
+ obj.width = savedWidth;
12737
+ }
12738
+ if (Math.abs((obj.scaleX ?? 1) - savedScaleX) > 0.01) {
12739
+ obj.scaleX = savedScaleX;
12740
+ }
12741
+ if (Math.abs((obj.scaleY ?? 1) - savedScaleY) > 0.01) {
12742
+ obj.scaleY = savedScaleY;
12743
+ }
12744
+ obj.setCoords();
12745
+ obj.dirty = true;
12746
+ return;
12747
+ }
12748
+ if (obj instanceof fabric.Group) {
12749
+ obj.getObjects().forEach(resyncTextboxWidths);
12750
+ obj.dirty = true;
12751
+ }
12752
+ };
12729
12753
  clearTextMetricCaches();
12730
12754
  await waitForPaint();
12755
+ fabricInstance.getObjects().forEach(resyncTextboxWidths);
12731
12756
  (_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
12732
12757
  (_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
12733
12758
  (_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);