@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.js
CHANGED
|
@@ -2699,18 +2699,37 @@ const clearFabricCharCache = () => {
|
|
|
2699
2699
|
};
|
|
2700
2700
|
const clearFontCacheAndRerender = (canvas) => {
|
|
2701
2701
|
clearFabricCharCache();
|
|
2702
|
-
const
|
|
2702
|
+
const resetTextboxLayoutInternals = (obj) => {
|
|
2703
2703
|
var _a;
|
|
2704
|
+
(_a = obj._clearCache) == null ? void 0 : _a.call(obj);
|
|
2705
|
+
obj.__charBounds = [];
|
|
2706
|
+
obj.__lineWidths = [];
|
|
2707
|
+
obj.__lineHeights = [];
|
|
2708
|
+
obj.__graphemeLines = [];
|
|
2709
|
+
obj._textLines = [];
|
|
2710
|
+
obj.textLines = [];
|
|
2711
|
+
obj._styleMap = null;
|
|
2712
|
+
obj.styleMap = null;
|
|
2713
|
+
obj.dirty = true;
|
|
2714
|
+
};
|
|
2715
|
+
const fixTextbox = (obj) => {
|
|
2716
|
+
var _a, _b;
|
|
2704
2717
|
if (obj instanceof fabric.Textbox) {
|
|
2705
2718
|
const savedWidth = obj.width;
|
|
2706
|
-
|
|
2719
|
+
const savedScaleX = obj.scaleX;
|
|
2720
|
+
const savedScaleY = obj.scaleY;
|
|
2721
|
+
resetTextboxLayoutInternals(obj);
|
|
2707
2722
|
obj.initDimensions();
|
|
2708
|
-
if (savedWidth != null
|
|
2709
|
-
obj.width
|
|
2723
|
+
if (savedWidth != null) {
|
|
2724
|
+
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY });
|
|
2725
|
+
resetTextboxLayoutInternals(obj);
|
|
2726
|
+
obj.initDimensions();
|
|
2727
|
+
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY, dirty: true });
|
|
2710
2728
|
}
|
|
2729
|
+
(_a = obj._clearCache) == null ? void 0 : _a.call(obj);
|
|
2711
2730
|
obj.setCoords();
|
|
2712
2731
|
} else if (obj instanceof fabric.Group) {
|
|
2713
|
-
(
|
|
2732
|
+
(_b = obj._objects) == null ? void 0 : _b.forEach(fixTextbox);
|
|
2714
2733
|
obj.dirty = true;
|
|
2715
2734
|
obj.setCoords();
|
|
2716
2735
|
}
|
|
@@ -12575,14 +12594,30 @@ class PixldocsRenderer {
|
|
|
12575
12594
|
scaleX: obj.scaleX,
|
|
12576
12595
|
scaleY: obj.scaleY
|
|
12577
12596
|
};
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
|
|
12597
|
+
const resetTextboxLayoutInternals = () => {
|
|
12598
|
+
var _a4;
|
|
12599
|
+
(_a4 = obj._clearCache) == null ? void 0 : _a4.call(obj);
|
|
12600
|
+
obj.__charBounds = [];
|
|
12601
|
+
obj.__lineWidths = [];
|
|
12602
|
+
obj.__lineHeights = [];
|
|
12603
|
+
obj.__graphemeLines = [];
|
|
12604
|
+
obj._textLines = [];
|
|
12605
|
+
obj.textLines = [];
|
|
12606
|
+
obj._styleMap = null;
|
|
12607
|
+
obj.styleMap = null;
|
|
12608
|
+
obj.dirty = true;
|
|
12609
|
+
};
|
|
12610
|
+
resetTextboxLayoutInternals();
|
|
12585
12611
|
obj.initDimensions();
|
|
12612
|
+
if (saved.width != null) {
|
|
12613
|
+
(_a3 = obj.set) == null ? void 0 : _a3.call(obj, {
|
|
12614
|
+
width: saved.width,
|
|
12615
|
+
scaleX: saved.scaleX,
|
|
12616
|
+
scaleY: saved.scaleY
|
|
12617
|
+
});
|
|
12618
|
+
resetTextboxLayoutInternals();
|
|
12619
|
+
obj.initDimensions();
|
|
12620
|
+
}
|
|
12586
12621
|
(_b2 = obj.set) == null ? void 0 : _b2.call(obj, {
|
|
12587
12622
|
width: saved.width,
|
|
12588
12623
|
scaleX: saved.scaleX,
|