@pixldocs/canvas-renderer 0.5.10 → 0.5.11

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
@@ -12568,23 +12568,41 @@ class PixldocsRenderer {
12568
12568
  clearMeasurementCache();
12569
12569
  };
12570
12570
  const reflowTextboxes = () => {
12571
- var _a2, _b;
12571
+ var _a2, _b, _c;
12572
12572
  const walk = (obj) => {
12573
- var _a3, _b2;
12573
+ var _a3, _b2, _c2, _d;
12574
12574
  if (!obj) return;
12575
12575
  const children = Array.isArray(obj._objects) ? obj._objects : Array.isArray(obj.objects) ? obj.objects : [];
12576
12576
  if (children.length) children.forEach(walk);
12577
- if (typeof obj.initDimensions === "function" && (obj.type === "textbox" || obj.isEditing !== void 0)) {
12578
- const savedWidth = obj.width;
12577
+ const isTextObject = typeof obj.text === "string" && typeof obj.initDimensions === "function" && (obj.type === "textbox" || obj.type === "text" || obj.type === "i-text" || obj.isEditing !== void 0);
12578
+ if (isTextObject) {
12579
+ const saved = {
12580
+ width: obj.width,
12581
+ scaleX: obj.scaleX,
12582
+ scaleY: obj.scaleY
12583
+ };
12584
+ (_a3 = obj._clearCache) == null ? void 0 : _a3.call(obj);
12585
+ obj.__charBounds = [];
12586
+ obj.__lineWidths = [];
12587
+ obj.__lineHeights = [];
12588
+ obj._textLines = [];
12589
+ obj.textLines = [];
12579
12590
  obj.dirty = true;
12580
12591
  obj.initDimensions();
12581
- if (savedWidth != null) (_a3 = obj.set) == null ? void 0 : _a3.call(obj, { width: savedWidth });
12582
- (_b2 = obj.setCoords) == null ? void 0 : _b2.call(obj);
12592
+ (_b2 = obj.set) == null ? void 0 : _b2.call(obj, {
12593
+ width: saved.width,
12594
+ scaleX: saved.scaleX,
12595
+ scaleY: saved.scaleY,
12596
+ dirty: true
12597
+ });
12598
+ (_c2 = obj._clearCache) == null ? void 0 : _c2.call(obj);
12599
+ (_d = obj.setCoords) == null ? void 0 : _d.call(obj);
12583
12600
  }
12584
12601
  };
12585
12602
  fabricInstance.getObjects().forEach(walk);
12586
12603
  (_a2 = fabricInstance.calcOffset) == null ? void 0 : _a2.call(fabricInstance);
12587
- (_b = fabricInstance.requestRenderAll) == null ? void 0 : _b.call(fabricInstance);
12604
+ (_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
12605
+ (_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);
12588
12606
  };
12589
12607
  clearTextMetricCaches();
12590
12608
  await waitForPaint();