Commit Graph

23 Commits

Author SHA1 Message Date
filtered
95af20c1c4 Snaps for Comfy 🫰 (#239)
* Add Snaps for Comfy

* Add snap visual effects

* Update node measure to work everywhere

* Fix findConnectByTypeSlot does not work for "*"

* Fix regression in fast widget conversion
2024-10-30 12:02:41 -04:00
filtered
0b174adfeb Move canvas state to plain object (#233)
* Move canvas state to plain object

POCO that can be proxied without side-effects.
LGraphCanvasState interface added to package exports

* Add item dragging to canvas state
2024-10-29 21:39:46 -04:00
filtered
21b9cb6089 Multi-link drag keeps links bundled properly (#224) 2024-10-28 19:00:08 -04:00
filtered
5070866299 Add / improve Node interfaces: Find slots & before connect callback (#226)
* Add connectByType wrappers

Can find slots without actually connecting.  Will be used for link snapping.

* Refactor - generic find free slot

* Fix link/links TS types - should not be undefined

* Fix / add TS types, docs

* Refactor - fix overloads TS types

* Refactor - optional chaining

* Extend node before-connect callback

The callback can now determine if connection is to a specific input, or just trying to connect any valid slot on the node.

* Add TS types - finish IOptionalInputsData
2024-10-28 18:59:43 -04:00
filtered
83cb795301 Fix group deselected on title click (#230) 2024-10-27 21:10:08 -04:00
filtered
748d35b610 Add hover highlight and link dragging features (#222)
* Add new hover highlight and link dragging features

- Hovering effects added for node inputs and outputs
- Adds "mouseout" handler to properly clear node state when mousing off a node
- Fixes bug that causes outputs to always be dimmed out when connecting from inputs
- Slight performance improvement

* Add node highlight text colour option

* Add slot highlight colour fallback
2024-10-27 16:57:41 -04:00
filtered
d3e0582c52 Add multi-group select & drag (#225) 2024-10-26 18:12:38 -04:00
filtered
3f5499f955 Canvas refactors - standardising (#221)
* Add distribute nodes

* Fix node alt-clone does not work like copy/paste

* Impl. emitEvent across LGraphCanvas

- Create TS types and union for all events
- Replaces all relevant dispatchEvent calls with emitEvent()

* Remove unused code

- showShowGraphOptionsPanel throws an exception when run.  Safe to assume this function not in use.
- Remove old commented code

* Refactor - minor changes to clear TS errors

* Add TS types

* nit - ts-expect-error, comments

* Remove legacy hook

* Refactor - prefer typeof / instanceof / isArray

* Refactor - TS type narrowing

* nit
2024-10-26 13:13:42 -04:00
filtered
955daac9e6 Fix circular dependency (#219)
* Fix circular dependency - LGraphCanvas static init

* Remove dependency workaround
2024-10-25 20:17:31 -04:00
filtered
d69a2ae9b0 Typescript LGraphCanvas (#202)
* Format only

* Revert accidental change

* Fix redundant falsy check - uninit. var

* nit - Refactor const/let

* nit - Refactor const/let (manual)

* nit - Redeclared params

* Add TS types & minor refactor only

* Refactor - Clean up / reformat

- Add strings.ts helper functions
- Remove unused vars & local function params
- Simplifies code
- Rename vars for clarity
- Add TODOs and other comments
- Add ts-expect-error

* Redirect draw.ts enums to global file (temp.)

Should be revisited after TS merge complete
Corrects import of types from draw.ts into interfaces

* Add measure.ts - move util funcs from Global

* Add all imports required for TS conversion

* Refactor - TS narrowing

* nit - TS types & minor refactor

* Add missing types from recent PRs

Removes duplicate declarations
Fixes some type mismatches

* nit - Refactor recent PRs

* Revert incorrect decls backported

* Remove unused params

* Add TS types only

* Fix minor TS type coercion issues

Also removes redundant code

* nit - Refactor

* Remove @ts-nocheck

* Fix refactor regression - drag link to output

Issue was the result of fixing var declared outside of closure

* Restore original logic

---------

Co-authored-by: huchenlei <huchenlei@proton.me>
2024-10-11 12:21:10 -04:00
filtered
5d510cd674 Revert "Format all code with prettier (#197)" (#198)
This reverts commit 28382b7e45.
2024-10-08 13:14:36 -04:00
Chenlei Hu
28382b7e45 Format all code with prettier (#197)
* Add formatter support

* Format all code

* Fix moved @ts-expect-error
2024-10-07 14:06:44 -04:00
Chenlei Hu
142c22ea41 Typescript conversion 0.7.84 (#194)
* Convert litegraph.js to TS

* Overhaul static litegraph.d.ts with updated types

* Fix rename oversights and revert fix unused param

- Some functions were broken by merging updated TS function signatures which included param renames
- Removal of unused params does not belong in the TS conversion PR, and has been reverted

* Remove legacy static .d.ts file

* Add callback decl from #180

Support allowing links to widgets (#180)
c23e610c11

* Convert NodeId to string | number

Results in significantly less downstream changes, despite being a change from the old static file.

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
2024-10-07 11:15:29 -04:00
Chenlei Hu
36a8b1fea0 Don't draw badges when zoomed out (#192) 2024-10-04 08:34:46 -04:00
bymyself
955dec36f2 Fix adding node to selection with ctrl click on mac (#189) 2024-10-02 10:41:41 -04:00
pythongosssss
c23e610c11 Support allowing links to widgets (#180)
* Add support for dragging links to widgets

* whitespace
2024-10-01 11:03:36 -04:00
Chenlei Hu
bb95a109e4 Allow panning when dragging a link (#185) 2024-10-01 10:29:34 -04:00
Chenlei Hu
1574c16918 Canvas panning mode (#183)
* nit

* Read-only on holding space

* Expose dragging events
2024-09-30 19:52:52 -04:00
bymyself
21d0f6c149 Fix drag-select on Mac (#182)
* Drag selection work with meta key

* Apply to dragging rectangle
2024-09-30 16:28:48 -04:00
pythongosssss
1c6f04f1db Add event when readonly changes (#160)
* Add even when readonly is changed

* Swap to ts private instead of es
2024-09-27 14:41:10 +09:00
huchenlei
96f62f8f93 Revert accidental changes 2024-09-27 10:43:53 +09:00
huchenlei
0652de8e66 Change cursor shape to grab on dragging 2024-09-27 10:43:53 +09:00
filtered
4a109deb8a Split LGraphCanvas out to TS file
Fixes circular dependency
2024-09-27 09:56:19 +09:00