@pixldocs/canvas-renderer 0.5.33 → 0.5.34
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 +5 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2769,45 +2769,16 @@ const clearFontCacheAndRerender = (canvas) => {
|
|
|
2769
2769
|
if (beforeMetrics.length > 0) {
|
|
2770
2770
|
logUnderlineDebug("before-rerender", beforeMetrics);
|
|
2771
2771
|
}
|
|
2772
|
-
const
|
|
2773
|
-
var _a
|
|
2772
|
+
const markDirty = (obj) => {
|
|
2773
|
+
var _a;
|
|
2774
2774
|
if (obj instanceof fabric__namespace.Textbox) {
|
|
2775
|
-
|
|
2776
|
-
const savedScaleX = obj.scaleX;
|
|
2777
|
-
const savedScaleY = obj.scaleY;
|
|
2778
|
-
obj._forceClearCache = true;
|
|
2779
|
-
obj.initDimensions();
|
|
2780
|
-
if (savedWidth != null) {
|
|
2781
|
-
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY });
|
|
2782
|
-
obj._forceClearCache = true;
|
|
2783
|
-
obj.initDimensions();
|
|
2784
|
-
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY, dirty: true });
|
|
2785
|
-
}
|
|
2786
|
-
if (obj.underline) {
|
|
2787
|
-
const lineWidths = obj.__lineWidths;
|
|
2788
|
-
logUnderlineDebug("textbox-rerender", {
|
|
2789
|
-
id: getObjectId(obj) ?? null,
|
|
2790
|
-
text: (obj.text || "").slice(0, 120),
|
|
2791
|
-
fontFamily: obj.fontFamily,
|
|
2792
|
-
fontSize: obj.fontSize,
|
|
2793
|
-
savedWidth,
|
|
2794
|
-
finalWidth: obj.width ?? null,
|
|
2795
|
-
finalHeight: obj.height ?? null,
|
|
2796
|
-
scaleX: obj.scaleX,
|
|
2797
|
-
scaleY: obj.scaleY,
|
|
2798
|
-
lineCount: ((_a = obj.textLines) == null ? void 0 : _a.length) ?? 0,
|
|
2799
|
-
maxLineWidth: lineWidths && lineWidths.length > 0 ? Math.max(...lineWidths) : null
|
|
2800
|
-
});
|
|
2801
|
-
}
|
|
2802
|
-
(_b = obj._clearCache) == null ? void 0 : _b.call(obj);
|
|
2803
|
-
obj.setCoords();
|
|
2775
|
+
obj.dirty = true;
|
|
2804
2776
|
} else if (obj instanceof fabric__namespace.Group) {
|
|
2805
|
-
(
|
|
2777
|
+
(_a = obj._objects) == null ? void 0 : _a.forEach(markDirty);
|
|
2806
2778
|
obj.dirty = true;
|
|
2807
|
-
obj.setCoords();
|
|
2808
2779
|
}
|
|
2809
2780
|
};
|
|
2810
|
-
canvas.getObjects().forEach(
|
|
2781
|
+
canvas.getObjects().forEach(markDirty);
|
|
2811
2782
|
const afterMetrics = canvas.getObjects().flatMap(collectUnderlineMetrics);
|
|
2812
2783
|
if (afterMetrics.length > 0) {
|
|
2813
2784
|
logUnderlineDebug("after-rerender", afterMetrics);
|