@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.js
CHANGED
|
@@ -2750,45 +2750,16 @@ const clearFontCacheAndRerender = (canvas) => {
|
|
|
2750
2750
|
if (beforeMetrics.length > 0) {
|
|
2751
2751
|
logUnderlineDebug("before-rerender", beforeMetrics);
|
|
2752
2752
|
}
|
|
2753
|
-
const
|
|
2754
|
-
var _a
|
|
2753
|
+
const markDirty = (obj) => {
|
|
2754
|
+
var _a;
|
|
2755
2755
|
if (obj instanceof fabric.Textbox) {
|
|
2756
|
-
|
|
2757
|
-
const savedScaleX = obj.scaleX;
|
|
2758
|
-
const savedScaleY = obj.scaleY;
|
|
2759
|
-
obj._forceClearCache = true;
|
|
2760
|
-
obj.initDimensions();
|
|
2761
|
-
if (savedWidth != null) {
|
|
2762
|
-
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY });
|
|
2763
|
-
obj._forceClearCache = true;
|
|
2764
|
-
obj.initDimensions();
|
|
2765
|
-
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY, dirty: true });
|
|
2766
|
-
}
|
|
2767
|
-
if (obj.underline) {
|
|
2768
|
-
const lineWidths = obj.__lineWidths;
|
|
2769
|
-
logUnderlineDebug("textbox-rerender", {
|
|
2770
|
-
id: getObjectId(obj) ?? null,
|
|
2771
|
-
text: (obj.text || "").slice(0, 120),
|
|
2772
|
-
fontFamily: obj.fontFamily,
|
|
2773
|
-
fontSize: obj.fontSize,
|
|
2774
|
-
savedWidth,
|
|
2775
|
-
finalWidth: obj.width ?? null,
|
|
2776
|
-
finalHeight: obj.height ?? null,
|
|
2777
|
-
scaleX: obj.scaleX,
|
|
2778
|
-
scaleY: obj.scaleY,
|
|
2779
|
-
lineCount: ((_a = obj.textLines) == null ? void 0 : _a.length) ?? 0,
|
|
2780
|
-
maxLineWidth: lineWidths && lineWidths.length > 0 ? Math.max(...lineWidths) : null
|
|
2781
|
-
});
|
|
2782
|
-
}
|
|
2783
|
-
(_b = obj._clearCache) == null ? void 0 : _b.call(obj);
|
|
2784
|
-
obj.setCoords();
|
|
2756
|
+
obj.dirty = true;
|
|
2785
2757
|
} else if (obj instanceof fabric.Group) {
|
|
2786
|
-
(
|
|
2758
|
+
(_a = obj._objects) == null ? void 0 : _a.forEach(markDirty);
|
|
2787
2759
|
obj.dirty = true;
|
|
2788
|
-
obj.setCoords();
|
|
2789
2760
|
}
|
|
2790
2761
|
};
|
|
2791
|
-
canvas.getObjects().forEach(
|
|
2762
|
+
canvas.getObjects().forEach(markDirty);
|
|
2792
2763
|
const afterMetrics = canvas.getObjects().flatMap(collectUnderlineMetrics);
|
|
2793
2764
|
if (afterMetrics.length > 0) {
|
|
2794
2765
|
logUnderlineDebug("after-rerender", afterMetrics);
|