More intuitive UX when connecting reroutes to each other.
- Remove middle reroutes when connecting around them
- Fix earlier reroutes in chain lost when stitching
- Fix all reroutes removed when stitching in reverse
Previously, gap between slots was the same height as the slot itself.
Gap is now entirely removed, bringing it inline with the
previously-modified snap and link connection hit boxes.
### Floating reroutes
Native reroutes can now be kept in a disconnected state.
Link chains may be kept provided they are connected to _either_ an input
or an output. By design, reroutes will be automatically removed if both
sides are disconnected.
- Fixes root cause of minor in-memory-only corruption when deleting
reroutes from output slots
- Already automatically corrected via serialisation
- If `reroutes` or `links` are empty arrays, removes them from newer
object-based serialised output entirely
- Minor refactors
- Removes unused code
- Fixes some serialisation types
- Adds `ReadonlyLinkNetwork` interface
- Enables floating reroutes
- Allows rendering logic for a chain of reroutes to be called without a
real `LLink` connected to an input
- Deprecates unused `visible_links` array
- Removes null widget skip - this _should_ throw
- Removes widget locator that was on LGraphCanvas - canvas should not
functions that find things in graph space.
Workaround originally implemented when converting to ES modules, but is
now redundant.
`DEFAULT_EVENT_LINK_COLOR` confirmed unused in code search (litegraph
events).
### LinkConnector
Replaces the minimal-change effort of `connecting_links` with a more
reliable implementation.
- Subscribable, event-based API
- Uses browser-standard `e.preventDefault()` to cancel `before-*` events
- Uses standard `state` POJO - can be proxied without issue
- Structures code and separates concerns out of `LGraphCanvas`
- Link creation calls can now be made from anywhere, without the need
for a rewrite
- New canvas sub-components now live in `src/canvas/`
### Rendering
- Skips link segments by setting a `_dragging` bool flag on the LLink or
Reroute
- Moves some previously nested code to event listeners, configured in
the `LGraphCanvas` constructor
### Deprecation
`LGraphCanvas.connecting_links` is now deprecated and will later be
removed.
Until it is removed, to prevent breaking extensions it will continue to
be set and cleared by a legacy callback. The contents of this property
are ignored; code search revealed no exentsions actually modifying the
array.
- Returns object with slot, index, and pos
- Locate-by-type returns object with slot & index
- Uses standard `undefined` return for concise chaining & validation
- Free 10x perf increase over getConnectionPos (used basic random data
to test, out of curiosity)
Fixes regression added in TS strict conversion. A fallback to `null`
added to match the TS type, however value being stored was actually
uncaught use of `undefined`.
`null` !== `undefined` -> redraw every frame the pointer moves