@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 +4 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12743,6 +12743,7 @@ class PixldocsRenderer {
|
|
|
12743
12743
|
return null;
|
|
12744
12744
|
}
|
|
12745
12745
|
async waitForStableTextMetrics(container, config) {
|
|
12746
|
+
var _a, _b, _c;
|
|
12746
12747
|
if (typeof document !== "undefined") {
|
|
12747
12748
|
void ensureFontsForResolvedConfig(config);
|
|
12748
12749
|
await this.waitForRelevantFonts(config);
|
|
@@ -12754,67 +12755,11 @@ class PixldocsRenderer {
|
|
|
12754
12755
|
clearFabricCharCache();
|
|
12755
12756
|
clearMeasurementCache();
|
|
12756
12757
|
};
|
|
12757
|
-
const reflowTextboxes = () => {
|
|
12758
|
-
var _a, _b, _c;
|
|
12759
|
-
const walk = (obj) => {
|
|
12760
|
-
var _a2, _b2, _c2, _d;
|
|
12761
|
-
if (!obj) return;
|
|
12762
|
-
const children = Array.isArray(obj._objects) ? obj._objects : Array.isArray(obj.objects) ? obj.objects : [];
|
|
12763
|
-
if (children.length) children.forEach(walk);
|
|
12764
|
-
const isTextObject = typeof obj.text === "string" && typeof obj.initDimensions === "function" && (obj.type === "textbox" || obj.type === "text" || obj.type === "i-text" || obj.isEditing !== void 0);
|
|
12765
|
-
if (isTextObject) {
|
|
12766
|
-
const saved = {
|
|
12767
|
-
width: obj.width,
|
|
12768
|
-
scaleX: obj.scaleX,
|
|
12769
|
-
scaleY: obj.scaleY
|
|
12770
|
-
};
|
|
12771
|
-
const resetTextboxLayoutInternals = () => {
|
|
12772
|
-
var _a3;
|
|
12773
|
-
(_a3 = obj._clearCache) == null ? void 0 : _a3.call(obj);
|
|
12774
|
-
obj.__charBounds = [];
|
|
12775
|
-
obj.__lineWidths = [];
|
|
12776
|
-
obj.__lineHeights = [];
|
|
12777
|
-
obj.__graphemeLines = [];
|
|
12778
|
-
obj._textLines = [];
|
|
12779
|
-
obj.textLines = [];
|
|
12780
|
-
obj._styleMap = null;
|
|
12781
|
-
obj.styleMap = null;
|
|
12782
|
-
obj.dirty = true;
|
|
12783
|
-
};
|
|
12784
|
-
resetTextboxLayoutInternals();
|
|
12785
|
-
obj.initDimensions();
|
|
12786
|
-
if (saved.width != null) {
|
|
12787
|
-
(_a2 = obj.set) == null ? void 0 : _a2.call(obj, {
|
|
12788
|
-
width: saved.width,
|
|
12789
|
-
scaleX: saved.scaleX,
|
|
12790
|
-
scaleY: saved.scaleY
|
|
12791
|
-
});
|
|
12792
|
-
resetTextboxLayoutInternals();
|
|
12793
|
-
obj.initDimensions();
|
|
12794
|
-
}
|
|
12795
|
-
(_b2 = obj.set) == null ? void 0 : _b2.call(obj, {
|
|
12796
|
-
width: saved.width,
|
|
12797
|
-
scaleX: saved.scaleX,
|
|
12798
|
-
scaleY: saved.scaleY,
|
|
12799
|
-
dirty: true
|
|
12800
|
-
});
|
|
12801
|
-
(_c2 = obj._clearCache) == null ? void 0 : _c2.call(obj);
|
|
12802
|
-
(_d = obj.setCoords) == null ? void 0 : _d.call(obj);
|
|
12803
|
-
}
|
|
12804
|
-
};
|
|
12805
|
-
fabricInstance.getObjects().forEach(walk);
|
|
12806
|
-
(_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
|
|
12807
|
-
(_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
|
|
12808
|
-
(_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);
|
|
12809
|
-
};
|
|
12810
|
-
clearTextMetricCaches();
|
|
12811
|
-
await waitForPaint();
|
|
12812
|
-
reflowTextboxes();
|
|
12813
|
-
await waitForPaint();
|
|
12814
12758
|
clearTextMetricCaches();
|
|
12815
|
-
reflowTextboxes();
|
|
12816
12759
|
await waitForPaint();
|
|
12817
|
-
|
|
12760
|
+
(_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
|
|
12761
|
+
(_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
|
|
12762
|
+
(_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);
|
|
12818
12763
|
await waitForPaint();
|
|
12819
12764
|
}
|
|
12820
12765
|
}
|