@pixldocs/canvas-renderer 0.4.7 → 0.4.9
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 +14 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4880,6 +4880,7 @@ const PageCanvas = react.forwardRef(
|
|
|
4880
4880
|
const prevCanvasUpdateVersionRef = react.useRef(canvasUpdateVersion);
|
|
4881
4881
|
const syncTriggeredByPanelRef = react.useRef(false);
|
|
4882
4882
|
const hasRunPostReadyReflowForPageRef = react.useRef(null);
|
|
4883
|
+
const hasNotifiedReadyForPageRef = react.useRef(null);
|
|
4883
4884
|
const hasClearedCachesBeforeFirstSyncRef = react.useRef(false);
|
|
4884
4885
|
const [guides, setGuides] = react.useState([]);
|
|
4885
4886
|
const [gridResizeLabel, setGridResizeLabel] = react.useState(null);
|
|
@@ -5142,10 +5143,8 @@ const PageCanvas = react.forwardRef(
|
|
|
5142
5143
|
clearFabricCharCache();
|
|
5143
5144
|
clearMeasurementCache();
|
|
5144
5145
|
setReady(true);
|
|
5145
|
-
if (onReady) onReady();
|
|
5146
5146
|
} catch (e) {
|
|
5147
5147
|
setReady(true);
|
|
5148
|
-
if (onReady) onReady();
|
|
5149
5148
|
}
|
|
5150
5149
|
};
|
|
5151
5150
|
initFonts();
|
|
@@ -7117,6 +7116,11 @@ const PageCanvas = react.forwardRef(
|
|
|
7117
7116
|
if (!ready || hasRunPostReadyReflowForPageRef.current === pageId) return;
|
|
7118
7117
|
hasRunPostReadyReflowForPageRef.current = pageId;
|
|
7119
7118
|
let cancelled = false;
|
|
7119
|
+
const notifyReady = () => {
|
|
7120
|
+
if (cancelled || hasNotifiedReadyForPageRef.current === pageId) return;
|
|
7121
|
+
hasNotifiedReadyForPageRef.current = pageId;
|
|
7122
|
+
onReady == null ? void 0 : onReady();
|
|
7123
|
+
};
|
|
7120
7124
|
const runReflowAndPersist = () => {
|
|
7121
7125
|
const fc = fabricRef.current;
|
|
7122
7126
|
if (!fc || cancelled) return;
|
|
@@ -7158,6 +7162,7 @@ const PageCanvas = react.forwardRef(
|
|
|
7158
7162
|
requestAnimationFrame(() => {
|
|
7159
7163
|
if (cancelled) return;
|
|
7160
7164
|
runReflowAndPersist();
|
|
7165
|
+
notifyReady();
|
|
7161
7166
|
});
|
|
7162
7167
|
});
|
|
7163
7168
|
});
|
|
@@ -7166,7 +7171,7 @@ const PageCanvas = react.forwardRef(
|
|
|
7166
7171
|
cancelled = true;
|
|
7167
7172
|
cancelAnimationFrame(raf1);
|
|
7168
7173
|
};
|
|
7169
|
-
}, [ready, pageId]);
|
|
7174
|
+
}, [ready, pageId, onReady]);
|
|
7170
7175
|
react.useEffect(() => {
|
|
7171
7176
|
const fc = fabricRef.current;
|
|
7172
7177
|
if (!fc || isRebuildingRef.current || !isActive) return;
|
|
@@ -10240,7 +10245,12 @@ function setInTree(nodes, elementId, targetProperty, value) {
|
|
|
10240
10245
|
} else {
|
|
10241
10246
|
node[targetProperty] = value;
|
|
10242
10247
|
}
|
|
10243
|
-
if (targetProperty === "text" && node.type === "text")
|
|
10248
|
+
if (targetProperty === "text" && node.type === "text") {
|
|
10249
|
+
const overflowPolicy = String(node.overflowPolicy ?? "grow-and-push");
|
|
10250
|
+
if (overflowPolicy !== "auto-shrink") {
|
|
10251
|
+
delete node.height;
|
|
10252
|
+
}
|
|
10253
|
+
}
|
|
10244
10254
|
return true;
|
|
10245
10255
|
}
|
|
10246
10256
|
if (node.children && Array.isArray(node.children)) {
|