@pixldocs/canvas-renderer 0.5.30 → 0.5.32

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
@@ -2769,30 +2769,17 @@ const clearFontCacheAndRerender = (canvas) => {
2769
2769
  if (beforeMetrics.length > 0) {
2770
2770
  logUnderlineDebug("before-rerender", beforeMetrics);
2771
2771
  }
2772
- const resetTextboxLayoutInternals = (obj) => {
2773
- var _a;
2774
- (_a = obj._clearCache) == null ? void 0 : _a.call(obj);
2775
- obj.__charBounds = [];
2776
- obj.__lineWidths = [];
2777
- obj.__lineHeights = [];
2778
- obj.__graphemeLines = [];
2779
- obj._textLines = [];
2780
- obj.textLines = [];
2781
- obj._styleMap = null;
2782
- obj.styleMap = null;
2783
- obj.dirty = true;
2784
- };
2785
2772
  const fixTextbox = (obj) => {
2786
2773
  var _a, _b, _c;
2787
2774
  if (obj instanceof fabric__namespace.Textbox) {
2788
2775
  const savedWidth = obj.width;
2789
2776
  const savedScaleX = obj.scaleX;
2790
2777
  const savedScaleY = obj.scaleY;
2791
- resetTextboxLayoutInternals(obj);
2778
+ obj._forceClearCache = true;
2792
2779
  obj.initDimensions();
2793
2780
  if (savedWidth != null) {
2794
2781
  obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY });
2795
- resetTextboxLayoutInternals(obj);
2782
+ obj._forceClearCache = true;
2796
2783
  obj.initDimensions();
2797
2784
  obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY, dirty: true });
2798
2785
  }
@@ -12788,53 +12775,7 @@ class PixldocsRenderer {
12788
12775
  };
12789
12776
  const reflowTextboxes = () => {
12790
12777
  var _a, _b, _c;
12791
- const walk = (obj) => {
12792
- var _a2, _b2, _c2, _d;
12793
- if (!obj) return;
12794
- const children = Array.isArray(obj._objects) ? obj._objects : Array.isArray(obj.objects) ? obj.objects : [];
12795
- if (children.length) children.forEach(walk);
12796
- const isTextObject = typeof obj.text === "string" && typeof obj.initDimensions === "function" && (obj.type === "textbox" || obj.type === "text" || obj.type === "i-text" || obj.isEditing !== void 0);
12797
- if (isTextObject) {
12798
- const saved = {
12799
- width: obj.width,
12800
- scaleX: obj.scaleX,
12801
- scaleY: obj.scaleY
12802
- };
12803
- const resetTextboxLayoutInternals = () => {
12804
- var _a3;
12805
- (_a3 = obj._clearCache) == null ? void 0 : _a3.call(obj);
12806
- obj.__charBounds = [];
12807
- obj.__lineWidths = [];
12808
- obj.__lineHeights = [];
12809
- obj.__graphemeLines = [];
12810
- obj._textLines = [];
12811
- obj.textLines = [];
12812
- obj._styleMap = null;
12813
- obj.styleMap = null;
12814
- obj.dirty = true;
12815
- };
12816
- resetTextboxLayoutInternals();
12817
- obj.initDimensions();
12818
- if (saved.width != null) {
12819
- (_a2 = obj.set) == null ? void 0 : _a2.call(obj, {
12820
- width: saved.width,
12821
- scaleX: saved.scaleX,
12822
- scaleY: saved.scaleY
12823
- });
12824
- resetTextboxLayoutInternals();
12825
- obj.initDimensions();
12826
- }
12827
- (_b2 = obj.set) == null ? void 0 : _b2.call(obj, {
12828
- width: saved.width,
12829
- scaleX: saved.scaleX,
12830
- scaleY: saved.scaleY,
12831
- dirty: true
12832
- });
12833
- (_c2 = obj._clearCache) == null ? void 0 : _c2.call(obj);
12834
- (_d = obj.setCoords) == null ? void 0 : _d.call(obj);
12835
- }
12836
- };
12837
- fabricInstance.getObjects().forEach(walk);
12778
+ clearFontCacheAndRerender(fabricInstance);
12838
12779
  (_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
12839
12780
  (_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
12840
12781
  (_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);