This should allow frontend drop the stroke logic in hijack of
`drawNodeShape`. Example usage:
```ts
node.strokeStyles["executionError"] = (this: LGraphNode) =>
app.lastNodeErrors?.[this.id] ? { colour: 'red', thickness: 2 } : undefined
```
- Resolves https://github.com/Comfy-Org/ComfyUI_frontend/issues/3247
Bypasses the logic that automatically removed reroutes that had no
remaining links. Reroutes are now always converted to floating whenever
reroutes are reconnected.
Example usage with ComfyUI_frontend, via console / devtools:
```ts
const inputIndicators = new InputIndicators(app.canvas)
// Dispose:
inputIndicators.dispose()
```
- Fixes floating inputs have invisible segment after moving
- Fixes floating input can be moved onto existing input link, resulting
in the slot having two links
Prevents nodes connecting links to themselves when moving existing
links.
If moving multiple links with reroutes, this will instead _reconnect_
any links that would become loopbacks, only without any rereoutes.
- Follow-up on #817
### Unit tests
Adds tests for:
- LinkConnector
- LGraph
### Integration tests for LinkConnector
- Uses and configures a real graph + LGraph
- Avoids mocks
- User input is still mocked
- Performs actual tasks as would be called by LGraphCanvas
- A little verbose in places, but _many_ edge cases are caught by these
tests
- Splits link connect logic out of `LinkConnector` to individual
`RenderLink` classes
- Add support for connecting / reconnecting reroutes in various
configurations
- Adds support for moving existing floating links from outputs / inputs
- Fixes numerous corruption issues when reconnecting reroutes / moving
links
- Tests in separate PR #816
- Updates UUIDv4 generator
- Adds a unique id & revision support to graphs
- `revision` to be incremented downstream (e.g. on save)
- `id` automatically assigned if not provided
Workaround originally implemented when converting to ES modules, but is
now redundant.
`DEFAULT_EVENT_LINK_COLOR` confirmed unused in code search (litegraph
events).
- Adds module entry point tests
- Manually resolved lint rules for module entry point imports / exports
(autofix could not resolve without causing issues)
Stylistic plugin falls short in a few areas when it comes to consistent
lists and chaining. Replaced some key rules with antfu's personal
variants.
`eslint` can now be run repo-wide without params.
* [API] Remove unused LiteGraph APIs
These features have not been maintained, and would require refactoring / rewrites. As code search revealed them to be unused, they are being removed.
- addNodeMethod
- compareObjects
- auto_sort_node_types
* Udpate API.md
* [Test] Revert custom name for test context
- Removes "lgTest", replaces with default "test"
* nit - Rename test extensions file
* Split test graphs out to separate file
* remove scaling of context menus based on graph scale
* deprecate scale in interface
* Add option to restore old context scaling behaviour
Revert "remove scaling of context menus based on graph scale"
This reverts commit d91ecaa86c671aea272844c3900a18da1af7bf01.
* Update test expectations
---------
Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
* Implement snap to grid
- Moves positioning logic to LGraph
- Simplifies code
- Adds Pointer API to alt-clone node
- Removes always_round_positions, replaced by always snap to grid (default size is 1 when always snapping)
Fix refator error
* Fix group items snapped without group
* Allow snapping of all items
- Add snapToGrid to Positionable
- Impl. on all types
- Deprecated: alignToGrid is now a wrapper
* Fix test import alias, update expectations
* Prevent desync of before / after change events
Adds ability to perform late binding of finally() during drag start.
* nit - Refactor
* Fix unwanted snap on node/group add
* nit - Doc
* Add shift key state tracking for snap to grid
Private impl., no state API as yet.
* Add snap guides rendering
Nodes, reroutes
* Optimisation - reroute rendering
Fixes exponential redraw
* Add snap guidelines for groups
* Add position rounding feature
Replaces previous impls. which only worked on some items, and were triggered when unexpected e.g. clicking a node that hadn't been moved.
Update test expectations
* Narrow TS types - readonly
* nit - Clean up, Doc
* nit - Clean up legacy accessors
Marks as deprecated
* Fix TS type - IContextMenuOptions.scale
* [Refactor] dist2 for use in pointer API
* Add CanvasPointer - API for pointer events
Add TS strict types
Add final click drag distance math
Add option to retain events
* nit - Rename
* nit
* Remove Subgraph - unused & not maintained
* Remove live_mode
Unused, not maintained.
* Update README
Remove live_mode reference
* Update delete selected - include reroutes & groups
* Bypass link menu if alt/shift pressed
* Remove old dragged_node interface
Incomplete impl. - unused.
Superceded by selectedItems
* Fix top/left edge of rectangles not in hitbox
* [Refactor] Match function names to interface names
* Add interface to find widgets by Point
LGraphNode.getWidgetOnPos
* Add widget search param - includeDisabled
* nit - Doc
* Rewrite canvas mouse handling
- Rewrites most pointer handling to use CanvasPointer callbacks
- All callbacks are declared ahead of time during the initial pointerdown event, logically grouped together
- Drastically simplifies the alteration or creation of new click / drag interactions
- Click events are all clicks, rather than some processed on mouse down, others on mouse up
- Functions return instead of setting and repeatedly checking multiple state vars
- Removes all lines that needed THIRTEEN tab indents
* Split middle click out from processMouseDown
* Use pointer API for link menus
* Narrow canvas event interfaces
* Fix canvas event types
Replaces original workarounds with final types
* Refactor - deprecated isInsideRectangle
* Add canvas hovering over state
- Centralises cursor set behaviour
- Provides simple downstream override
* nit
* [Refactor] Use measure functions
* Add double-click API to CanvasPointer
a
* nit - Doc
* Allow larger gap between double click events
* Rewrite double-click into CanvasPointer actions
* Improve double-click UX
Prefer down events over up events
* Add production defaults
* Add middle-click handling
* Remove debug code
* Remove redundant code
* Fix add reroute alt-click adds two undo steps
* Fix click on connected input disconnects
Old behaviour was to disconnect, then recreate a new link on drop.
* Add module export: CanvasPointer