@pixldocs/canvas-renderer 0.5.12 → 0.5.13
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 +47 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2718,18 +2718,37 @@ const clearFabricCharCache = () => {
|
|
|
2718
2718
|
};
|
|
2719
2719
|
const clearFontCacheAndRerender = (canvas) => {
|
|
2720
2720
|
clearFabricCharCache();
|
|
2721
|
-
const
|
|
2721
|
+
const resetTextboxLayoutInternals = (obj) => {
|
|
2722
2722
|
var _a;
|
|
2723
|
+
(_a = obj._clearCache) == null ? void 0 : _a.call(obj);
|
|
2724
|
+
obj.__charBounds = [];
|
|
2725
|
+
obj.__lineWidths = [];
|
|
2726
|
+
obj.__lineHeights = [];
|
|
2727
|
+
obj.__graphemeLines = [];
|
|
2728
|
+
obj._textLines = [];
|
|
2729
|
+
obj.textLines = [];
|
|
2730
|
+
obj._styleMap = null;
|
|
2731
|
+
obj.styleMap = null;
|
|
2732
|
+
obj.dirty = true;
|
|
2733
|
+
};
|
|
2734
|
+
const fixTextbox = (obj) => {
|
|
2735
|
+
var _a, _b;
|
|
2723
2736
|
if (obj instanceof fabric__namespace.Textbox) {
|
|
2724
2737
|
const savedWidth = obj.width;
|
|
2725
|
-
|
|
2738
|
+
const savedScaleX = obj.scaleX;
|
|
2739
|
+
const savedScaleY = obj.scaleY;
|
|
2740
|
+
resetTextboxLayoutInternals(obj);
|
|
2726
2741
|
obj.initDimensions();
|
|
2727
|
-
if (savedWidth != null
|
|
2728
|
-
obj.width
|
|
2742
|
+
if (savedWidth != null) {
|
|
2743
|
+
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY });
|
|
2744
|
+
resetTextboxLayoutInternals(obj);
|
|
2745
|
+
obj.initDimensions();
|
|
2746
|
+
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY, dirty: true });
|
|
2729
2747
|
}
|
|
2748
|
+
(_a = obj._clearCache) == null ? void 0 : _a.call(obj);
|
|
2730
2749
|
obj.setCoords();
|
|
2731
2750
|
} else if (obj instanceof fabric__namespace.Group) {
|
|
2732
|
-
(
|
|
2751
|
+
(_b = obj._objects) == null ? void 0 : _b.forEach(fixTextbox);
|
|
2733
2752
|
obj.dirty = true;
|
|
2734
2753
|
obj.setCoords();
|
|
2735
2754
|
}
|
|
@@ -12594,14 +12613,30 @@ class PixldocsRenderer {
|
|
|
12594
12613
|
scaleX: obj.scaleX,
|
|
12595
12614
|
scaleY: obj.scaleY
|
|
12596
12615
|
};
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12616
|
+
const resetTextboxLayoutInternals = () => {
|
|
12617
|
+
var _a4;
|
|
12618
|
+
(_a4 = obj._clearCache) == null ? void 0 : _a4.call(obj);
|
|
12619
|
+
obj.__charBounds = [];
|
|
12620
|
+
obj.__lineWidths = [];
|
|
12621
|
+
obj.__lineHeights = [];
|
|
12622
|
+
obj.__graphemeLines = [];
|
|
12623
|
+
obj._textLines = [];
|
|
12624
|
+
obj.textLines = [];
|
|
12625
|
+
obj._styleMap = null;
|
|
12626
|
+
obj.styleMap = null;
|
|
12627
|
+
obj.dirty = true;
|
|
12628
|
+
};
|
|
12629
|
+
resetTextboxLayoutInternals();
|
|
12604
12630
|
obj.initDimensions();
|
|
12631
|
+
if (saved.width != null) {
|
|
12632
|
+
(_a3 = obj.set) == null ? void 0 : _a3.call(obj, {
|
|
12633
|
+
width: saved.width,
|
|
12634
|
+
scaleX: saved.scaleX,
|
|
12635
|
+
scaleY: saved.scaleY
|
|
12636
|
+
});
|
|
12637
|
+
resetTextboxLayoutInternals();
|
|
12638
|
+
obj.initDimensions();
|
|
12639
|
+
}
|
|
12605
12640
|
(_b2 = obj.set) == null ? void 0 : _b2.call(obj, {
|
|
12606
12641
|
width: saved.width,
|
|
12607
12642
|
scaleX: saved.scaleX,
|