@pixldocs/canvas-renderer 0.5.31 → 0.5.33

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 CHANGED
@@ -12762,6 +12762,7 @@ class PixldocsRenderer {
12762
12762
  return null;
12763
12763
  }
12764
12764
  async waitForStableTextMetrics(container, config) {
12765
+ var _a, _b, _c;
12765
12766
  if (typeof document !== "undefined") {
12766
12767
  void ensureFontsForResolvedConfig(config);
12767
12768
  await this.waitForRelevantFonts(config);
@@ -12773,67 +12774,11 @@ class PixldocsRenderer {
12773
12774
  clearFabricCharCache();
12774
12775
  clearMeasurementCache();
12775
12776
  };
12776
- const reflowTextboxes = () => {
12777
- var _a, _b, _c;
12778
- const walk = (obj) => {
12779
- var _a2, _b2, _c2, _d;
12780
- if (!obj) return;
12781
- const children = Array.isArray(obj._objects) ? obj._objects : Array.isArray(obj.objects) ? obj.objects : [];
12782
- if (children.length) children.forEach(walk);
12783
- const isTextObject = typeof obj.text === "string" && typeof obj.initDimensions === "function" && (obj.type === "textbox" || obj.type === "text" || obj.type === "i-text" || obj.isEditing !== void 0);
12784
- if (isTextObject) {
12785
- const saved = {
12786
- width: obj.width,
12787
- scaleX: obj.scaleX,
12788
- scaleY: obj.scaleY
12789
- };
12790
- const resetTextboxLayoutInternals = () => {
12791
- var _a3;
12792
- (_a3 = obj._clearCache) == null ? void 0 : _a3.call(obj);
12793
- obj.__charBounds = [];
12794
- obj.__lineWidths = [];
12795
- obj.__lineHeights = [];
12796
- obj.__graphemeLines = [];
12797
- obj._textLines = [];
12798
- obj.textLines = [];
12799
- obj._styleMap = null;
12800
- obj.styleMap = null;
12801
- obj.dirty = true;
12802
- };
12803
- resetTextboxLayoutInternals();
12804
- obj.initDimensions();
12805
- if (saved.width != null) {
12806
- (_a2 = obj.set) == null ? void 0 : _a2.call(obj, {
12807
- width: saved.width,
12808
- scaleX: saved.scaleX,
12809
- scaleY: saved.scaleY
12810
- });
12811
- resetTextboxLayoutInternals();
12812
- obj.initDimensions();
12813
- }
12814
- (_b2 = obj.set) == null ? void 0 : _b2.call(obj, {
12815
- width: saved.width,
12816
- scaleX: saved.scaleX,
12817
- scaleY: saved.scaleY,
12818
- dirty: true
12819
- });
12820
- (_c2 = obj._clearCache) == null ? void 0 : _c2.call(obj);
12821
- (_d = obj.setCoords) == null ? void 0 : _d.call(obj);
12822
- }
12823
- };
12824
- fabricInstance.getObjects().forEach(walk);
12825
- (_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
12826
- (_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
12827
- (_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);
12828
- };
12829
- clearTextMetricCaches();
12830
- await waitForPaint();
12831
- reflowTextboxes();
12832
- await waitForPaint();
12833
12777
  clearTextMetricCaches();
12834
- reflowTextboxes();
12835
12778
  await waitForPaint();
12836
- reflowTextboxes();
12779
+ (_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
12780
+ (_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
12781
+ (_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);
12837
12782
  await waitForPaint();
12838
12783
  }
12839
12784
  }