@foblex/flow 19.1.2 → 19.1.3
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/AI.md +1 -0
- package/fesm2022/foblex-flow.mjs +24 -8
- package/fesm2022/foblex-flow.mjs.map +1 -1
- package/index.d.ts +6 -3
- package/package.json +1 -1
package/AI.md
CHANGED
|
@@ -139,6 +139,7 @@ export class Editor {
|
|
|
139
139
|
- Rotation, connection waypoint editing, and user resize are not captured by managed state in v1.
|
|
140
140
|
- `state.changes()` increments once when a standalone mutation or outer batch settles. A drag can emit selection at start and move/drop at end while remaining one history step and one `changes()` increment.
|
|
141
141
|
- Use `state.snapshot()` for persistence; `load()` replaces data and resets history.
|
|
142
|
+
- `canvasTransformDebounce` defaults to `350ms`. It waits for wheel/pinch zoom events to settle, then records the current canvas transform as one change and one undo item. Setting it to `0` disables batching: every emitted `fCanvasChange` is applied immediately, increments `state.changes()`, and normally creates a separate undo item. Keep the canvas `[debounceTime]` unset when managed state owns viewport history; do not stack canvas and State debounce layers.
|
|
142
143
|
- For initial or other application-driven viewport positioning, suppress the event at the canvas helper: `canvas.resetScaleAndCenter(false, false)`. The second `false` means `emitCanvasChange = false`, so managed history is untouched.
|
|
143
144
|
- Connection endpoints are connector ids. Automatic cascade from node/group deletion uses the rendered connector registry; before connectors render, remove known attached connection ids explicitly in the same `state.batch(...)`.
|
|
144
145
|
|
package/fesm2022/foblex-flow.mjs
CHANGED
|
@@ -22492,7 +22492,7 @@ function mergeFlowStateConfig(config) {
|
|
|
22492
22492
|
historyLimit: 50,
|
|
22493
22493
|
selectionInHistory: true,
|
|
22494
22494
|
canvasTransformInHistory: true,
|
|
22495
|
-
canvasTransformDebounce:
|
|
22495
|
+
canvasTransformDebounce: 350,
|
|
22496
22496
|
dropToGroup: false,
|
|
22497
22497
|
...config,
|
|
22498
22498
|
};
|
|
@@ -23308,18 +23308,34 @@ class FFlowStateController {
|
|
|
23308
23308
|
if (this._transformDebounceTimer !== null) {
|
|
23309
23309
|
clearTimeout(this._transformDebounceTimer);
|
|
23310
23310
|
}
|
|
23311
|
+
this._scheduleCanvasChangeFlush(debounce);
|
|
23312
|
+
}
|
|
23313
|
+
_flushCanvasChange() {
|
|
23314
|
+
const pending = this._pendingTransform;
|
|
23315
|
+
if (!pending) {
|
|
23316
|
+
return;
|
|
23317
|
+
}
|
|
23318
|
+
const current = this._readCanvasTransform();
|
|
23319
|
+
const debounce = this._config?.canvasTransformDebounce ?? 0;
|
|
23320
|
+
if (debounce > 0 && current && !this._isSameCanvasTransform(pending, current)) {
|
|
23321
|
+
this._pendingTransform = current;
|
|
23322
|
+
this._scheduleCanvasChangeFlush(debounce);
|
|
23323
|
+
return;
|
|
23324
|
+
}
|
|
23325
|
+
this._pendingTransform = null;
|
|
23326
|
+
const settled = debounce > 0 ? (current ?? pending) : pending;
|
|
23327
|
+
this._dispatch(() => this._state.applyTransform(settled));
|
|
23328
|
+
}
|
|
23329
|
+
_scheduleCanvasChangeFlush(debounce) {
|
|
23311
23330
|
this._transformDebounceTimer = setTimeout(() => {
|
|
23312
23331
|
this._transformDebounceTimer = null;
|
|
23313
23332
|
this._flushCanvasChange();
|
|
23314
23333
|
}, debounce);
|
|
23315
23334
|
}
|
|
23316
|
-
|
|
23317
|
-
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
return;
|
|
23321
|
-
}
|
|
23322
|
-
this._dispatch(() => this._state.applyTransform(transform));
|
|
23335
|
+
_isSameCanvasTransform(first, second) {
|
|
23336
|
+
return (first.position.x === second.position.x &&
|
|
23337
|
+
first.position.y === second.position.y &&
|
|
23338
|
+
first.scale === second.scale);
|
|
23323
23339
|
}
|
|
23324
23340
|
/**
|
|
23325
23341
|
* Subscribes to every node's and group's `sizeChange` (a per-directive
|