@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 +3 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -62
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2750,30 +2750,17 @@ const clearFontCacheAndRerender = (canvas) => {
|
|
|
2750
2750
|
if (beforeMetrics.length > 0) {
|
|
2751
2751
|
logUnderlineDebug("before-rerender", beforeMetrics);
|
|
2752
2752
|
}
|
|
2753
|
-
const resetTextboxLayoutInternals = (obj) => {
|
|
2754
|
-
var _a;
|
|
2755
|
-
(_a = obj._clearCache) == null ? void 0 : _a.call(obj);
|
|
2756
|
-
obj.__charBounds = [];
|
|
2757
|
-
obj.__lineWidths = [];
|
|
2758
|
-
obj.__lineHeights = [];
|
|
2759
|
-
obj.__graphemeLines = [];
|
|
2760
|
-
obj._textLines = [];
|
|
2761
|
-
obj.textLines = [];
|
|
2762
|
-
obj._styleMap = null;
|
|
2763
|
-
obj.styleMap = null;
|
|
2764
|
-
obj.dirty = true;
|
|
2765
|
-
};
|
|
2766
2753
|
const fixTextbox = (obj) => {
|
|
2767
2754
|
var _a, _b, _c;
|
|
2768
2755
|
if (obj instanceof fabric.Textbox) {
|
|
2769
2756
|
const savedWidth = obj.width;
|
|
2770
2757
|
const savedScaleX = obj.scaleX;
|
|
2771
2758
|
const savedScaleY = obj.scaleY;
|
|
2772
|
-
|
|
2759
|
+
obj._forceClearCache = true;
|
|
2773
2760
|
obj.initDimensions();
|
|
2774
2761
|
if (savedWidth != null) {
|
|
2775
2762
|
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY });
|
|
2776
|
-
|
|
2763
|
+
obj._forceClearCache = true;
|
|
2777
2764
|
obj.initDimensions();
|
|
2778
2765
|
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY, dirty: true });
|
|
2779
2766
|
}
|
|
@@ -12769,53 +12756,7 @@ class PixldocsRenderer {
|
|
|
12769
12756
|
};
|
|
12770
12757
|
const reflowTextboxes = () => {
|
|
12771
12758
|
var _a, _b, _c;
|
|
12772
|
-
|
|
12773
|
-
var _a2, _b2, _c2, _d;
|
|
12774
|
-
if (!obj) return;
|
|
12775
|
-
const children = Array.isArray(obj._objects) ? obj._objects : Array.isArray(obj.objects) ? obj.objects : [];
|
|
12776
|
-
if (children.length) children.forEach(walk);
|
|
12777
|
-
const isTextObject = typeof obj.text === "string" && typeof obj.initDimensions === "function" && (obj.type === "textbox" || obj.type === "text" || obj.type === "i-text" || obj.isEditing !== void 0);
|
|
12778
|
-
if (isTextObject) {
|
|
12779
|
-
const saved = {
|
|
12780
|
-
width: obj.width,
|
|
12781
|
-
scaleX: obj.scaleX,
|
|
12782
|
-
scaleY: obj.scaleY
|
|
12783
|
-
};
|
|
12784
|
-
const resetTextboxLayoutInternals = () => {
|
|
12785
|
-
var _a3;
|
|
12786
|
-
(_a3 = obj._clearCache) == null ? void 0 : _a3.call(obj);
|
|
12787
|
-
obj.__charBounds = [];
|
|
12788
|
-
obj.__lineWidths = [];
|
|
12789
|
-
obj.__lineHeights = [];
|
|
12790
|
-
obj.__graphemeLines = [];
|
|
12791
|
-
obj._textLines = [];
|
|
12792
|
-
obj.textLines = [];
|
|
12793
|
-
obj._styleMap = null;
|
|
12794
|
-
obj.styleMap = null;
|
|
12795
|
-
obj.dirty = true;
|
|
12796
|
-
};
|
|
12797
|
-
resetTextboxLayoutInternals();
|
|
12798
|
-
obj.initDimensions();
|
|
12799
|
-
if (saved.width != null) {
|
|
12800
|
-
(_a2 = obj.set) == null ? void 0 : _a2.call(obj, {
|
|
12801
|
-
width: saved.width,
|
|
12802
|
-
scaleX: saved.scaleX,
|
|
12803
|
-
scaleY: saved.scaleY
|
|
12804
|
-
});
|
|
12805
|
-
resetTextboxLayoutInternals();
|
|
12806
|
-
obj.initDimensions();
|
|
12807
|
-
}
|
|
12808
|
-
(_b2 = obj.set) == null ? void 0 : _b2.call(obj, {
|
|
12809
|
-
width: saved.width,
|
|
12810
|
-
scaleX: saved.scaleX,
|
|
12811
|
-
scaleY: saved.scaleY,
|
|
12812
|
-
dirty: true
|
|
12813
|
-
});
|
|
12814
|
-
(_c2 = obj._clearCache) == null ? void 0 : _c2.call(obj);
|
|
12815
|
-
(_d = obj.setCoords) == null ? void 0 : _d.call(obj);
|
|
12816
|
-
}
|
|
12817
|
-
};
|
|
12818
|
-
fabricInstance.getObjects().forEach(walk);
|
|
12759
|
+
clearFontCacheAndRerender(fabricInstance);
|
|
12819
12760
|
(_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
|
|
12820
12761
|
(_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
|
|
12821
12762
|
(_c = fabricInstance.requestRenderAll) == null ? void 0 : _c.call(fabricInstance);
|