Commit Graph

1250 Commits

Author SHA1 Message Date
filtered
3d6adf0225 Add Reroutes (#301)
* Add Reroute

- Initial Reroute implementation
- LLink and Reroute both implement the new LinkSegment interface
- LinkSegments can have a parentId, which always points to a Reroute

* Narrow TS type of schema v0.4 extras

* Add reroutes to schema 0.4

Use extras.reroutes to store additional data

* Add Reroute POC to LLink

* Add Reroute rendering

* Add Reroute context menu - Delete Reroute

* Update delete selected - include reroutes & groups

* Add Reroute select & move

* Include reroutes in area-select

* Move disconnect link logic to LLink

* Add Reroute connect

* nit

* Add Reroute support - connecting links

* Add Add Reroute from link menu (menu)

* nit

* Add shift-drag from reroute to add new link

* Prevent Reroutes from disappearing

Add keepReroutes option to prevent Reroute GC

* Add fourth param to connectInputToOutput

* Allow both connecting in/out to be null

* Move ConnectingLink start pos to Reroute

* Add link render options

* Refactor renderLink - spline / bezier

* Refactor renderLink - linear, straight

* Fix centre points on all link types

Improves link render time

* [Refactor] Generic recursive interface / flat set

* nit

* Allow Reroutes to be members of groups

* Start links from the closest reroute

For the "shift-click drag link from link" feature

* Add Reroutes using alt-click on link paths

* nit - Refactor

* nit - Refactor

* Fix reroute deselect UX

Temporary workaround

* Add Reroute link centre-marker handling

* Add optional link arrow markers

Add enum for link markers
-> Pointing the way forward ->
Set default centre marker to arrow

* Add module export: LinkMarkerShape

* Add link arrow direction for all link types

* Add Reroute auto-swivel with custom curves

* Add state switch to disable reroutes

Works at root of all canvas interactions, should leave existing reroutes untouched but invisible until e.g. links are edited / changed.

* Fix cannot deselect when reroutes disabled

* Include reroutes in select-all
2024-11-12 11:18:48 -05:00
Chenlei Hu
c6d7a446f2 0.8.25 (#299) 2024-11-10 09:56:51 -05:00
Chenlei Hu
75678ee43c Fix NODE_TEXT_SIZE style option (#298) 2024-11-10 09:54:07 -05:00
filtered
ca8e31c695 Emit only one change when deleting nodes (#296) 2024-11-10 09:40:36 -05:00
Chenlei Hu
9aa5bb69e8 0.8.24 (#293) 2024-11-08 14:22:43 -05:00
Chenlei Hu
34f8d3408b Add LGraphCavnas.fitViewToSelectionAnimated (#292) 2024-11-08 14:22:18 -05:00
Chenlei Hu
ca7192b1ba 0.8.23 (#291) 2024-11-08 13:50:17 -05:00
Chenlei Hu
c7d5c863ec Move createBounds to measure.ts (#290)
* nit

* Move createBounds to measure

* Export createBounds
2024-11-08 13:49:30 -05:00
Zoltán Dócs
6ad864bc20 Animate view to multiple nodes (#282)
* animateToNodes
- modify existing animation method to support passing multiple nodes, in which case the view is fit to the bounding box around them

* animateToBounds

* amend

* format

* amend
2024-11-08 13:40:15 -05:00
filtered
87c6d59546 Keep links connected when deleting nodes (#288)
* Allow node delete to keep more links connected

* Allow node delete to match every link

* Add config for connectInputToOutput
2024-11-08 11:13:14 -05:00
filtered
3e28ec5981 Update tests for schema v1 (#289) 2024-11-08 11:12:09 -05:00
Chenlei Hu
0f1c54081f 0.8.22 (#287) 2024-11-07 18:34:30 -05:00
filtered
fc0b8087db Graph serialisation update - Links & Reroutes (#279)
* nit

* Add LGraph state POCO

Moves last_link_id, last_node_id and creates same for group and reroute

fix import

* Add new serialisation to LGraph

Add LGraph schema 1
Remove reroute from old serialised graph
Remove brittle inherited types
Ensure stale links are not kept when clearing graph

* Add serialisable exports

* Ensure valid LGraph.state during deserialise
2024-11-07 18:33:54 -05:00
filtered
1c40aad87c Fix pin not respected by multi-select move (#284) 2024-11-07 15:58:49 -05:00
Chenlei Hu
80cbe491f8 0.8.21 (#283) 2024-11-06 21:47:31 -05:00
filtered
e1aac5cf61 Improve hitbox for group resize (#277)
Now the same as the visual area

Co-authored-by: Chenlei Hu <huchenlei@proton.me>
2024-11-06 19:35:56 -05:00
filtered
7e21b00cc7 Replace test framework: jest -> vitest (#281)
* Replace test framework: jest -> vitest

* nit - remove deprecated npm scripts

* Add vitest config

* Add a few basic tests

* Update actions with vitest params

* Add correct expectations

* Remove jest config
2024-11-06 17:27:32 -05:00
Chenlei Hu
93c26ac99e 0.8.20 (#280) 2024-11-05 18:36:37 -05:00
filtered
2ba048de52 Remove hard-coded modifications to nodes (#247)
* Remove arbitrary 5 graph unit margin around nodes

* Remove arbitrary +1 pixel added to node width

---------

Co-authored-by: Chenlei Hu <huchenlei@proton.me>
2024-11-05 18:35:59 -05:00
filtered
e6961f1c5a Code cleanup, docs, TS types (#278)
* Fix test TS types

Prefer relative imports over @imports

* Add tuple names SerialisedLLinkArray

* nit

* [Refactor] LGraphCanvas.computeConnectionPoint

* [Refactor] Add LGraphCanvas.#dirty()

* Remove string LLink IDs

No downstream support for strings at present.

* nit - Rename

* nit

* nit

* nit - Remove unused code

* nit - Doc

* nit

* nit - Remove redundant code

* Remove unused: LGraphCanvas.isOverNodeBox

* Optimise - remove 2d context save/restore

* [Refactor] Move node collapsed check to class

* Add minor code change to support stricter types

* Revert accidental deletion in 0f2d04d

0f2d04d09e5e8a27a6d46d8c910dc077ed2d9071
2024-11-04 21:08:59 -05:00
Chenlei Hu
e1a118a70f 0.8.19 (#276) 2024-11-04 15:10:16 -05:00
Chenlei Hu
5edfc185c5 Unify pin/unpin interface between LGraphNode and LGraphGroup (#274) 2024-11-04 15:09:17 -05:00
Chenlei Hu
b663f86c9e Serialize to node pos/size to plain array (#273) 2024-11-04 14:08:09 -05:00
Chenlei Hu
6c60045208 0.8.18 (#272) 2024-11-03 18:31:45 -05:00
filtered
ba52402851 Replace canvas "action" magic strings (#271) 2024-11-03 18:30:19 -05:00
filtered
ce8d39f650 Group update - titlebar, resize, config (#270)
* Backport group header from frontend

* nit - TS types & redundant code

* Refactor - simplify group resize

* Fix group resize can be inverted

* Move group resize check to group class

* Add config for group padding & default colour

* nit - Remove redundant code
2024-11-03 18:27:41 -05:00
filtered
3be1937c41 Update delete selected (#269)
* Standardise naming - deleteSelected

Renamed from deleteSelectedItems

* nit - Refactor to match future state
2024-11-03 18:10:46 -05:00
Chenlei Hu
d874493405 0.8.17 (#267) 2024-11-03 17:28:43 -05:00
Chenlei Hu
88edf11068 Create unique branch name [skip ci] (#266) 2024-11-03 17:26:05 -05:00
Chenlei Hu
6180f5ef55 Backspace delete selected (Nodes + Groups) (#265)
* Backspace delete selected (Nodes + Groups)

* nit

* nit
2024-11-03 17:22:08 -05:00
Chenlei Hu
62bc1ecd9f Ctrl+a select all items (Group + Node) (#264)
* Ctrl+a select all items (Group + Node)

* refactor

* nit
2024-11-03 17:16:11 -05:00
Chenlei Hu
30642850cb 0.8.16 (#263)
* Checkout new branch on release script run

* 0.8.16

* nit
2024-11-03 16:26:07 -05:00
filtered
1b110a62cf Add multi select & group nesting (#262)
* Add multi-select all canvas items (groups, nodes)

* Add Feat: Group & Node Multi-Select / Nesting

- Groups can now contain groups
- Nested groups re-order on top of parent groups
- Groups can be added / removed from selection
- Uses new Positionable interface - easily extensible to new types

* Enhance add / remove from selection UX

More in line with normal desktop UX.  Structured for keys to be customisable (if impl. later).

* Fix regression in link highlight

Legacy selection code still in use

* Allow nested groups to align perfectly on edges

* Remove group-move position rounding

Did not work under all circumstances, and resulted in misalignment more often than it helped.
2024-11-03 16:21:21 -05:00
filtered
e661decddc Positionable: Common interface for canvas items (#256)
* Add Positionable interface to canvas elements

* Add group resizeTo children

Refactor out duplicated code from Node

* Remove redundant "is_selected" check

* Improve measure pass - interface, caching

Node bounds once per render
Cached results

* Use cached bounds for repeat canvas calls

- Removes margin param from getNodeOnPos
- Removes margin param from getGroupOnPos
- Hitboxes now uniform for render / mouse features
- Simplifies code

* nit - Refactor

* Fix top-left edge of hitbox missing

* Add ID to groups
2024-11-03 11:12:21 -05:00
Chenlei Hu
d9efeb819d 0.8.15 (#260) 2024-11-03 10:47:54 -05:00
Chenlei Hu
6200aa8602 Reland animateToNode (#259)
* Reland animateToNode

* nit
2024-11-03 10:45:42 -05:00
Chenlei Hu
4dc3dc97f8 [Reland][skip ci] (add) watch to package.json scripts
Co-authored-by: dmx <vincent.f@intp.com>
2024-11-03 09:51:00 -05:00
Chenlei Hu
7c0240857c Revert branch to cb6e80a645 (#257) 2024-11-03 09:12:47 -05:00
dmx
9b0f572ca1 (feature) animateToNode method 2024-11-03 17:18:34 +04:00
dmx
11fe365983 (add) onPositionChanged and onZoomChanged events 2024-11-03 17:03:30 +04:00
dmx
13c8c80509 (add) watch to package.json scripts 2024-11-03 17:02:37 +04:00
dmx
78426148ac fix TS error 'Timeout' is not assignable to type 'number' 2024-11-03 10:00:38 +04:00
dmx
c8bac1aa40 add onNodeUpdated event in LGraph 2024-11-03 09:44:48 +04:00
dmx
79c53e0095 (prettier formatting) 2024-11-03 09:20:57 +04:00
dmx
cb6e80a645 update gitignore 2024-11-03 06:57:25 +04:00
Chenlei Hu
9ec17c04a9 Update test ci action (#255) 2024-11-02 13:11:32 -04:00
filtered
1dfe824239 Shared measure functions (#254)
* Add findPointOnCurve function

* Add measure functions: contains centre/rect

* Improve measure interfaces (ReadOnlyPoint/Rect)

* nit - Doc

* Add TS strict types

* Add TS strict types

* Add TS strict types

* Add TS type
2024-11-02 10:35:36 -04:00
filtered
c0217dbb7e Remove _ctor pattern from Node & Group (#248)
Convert to initializers
2024-11-01 23:12:03 -04:00
filtered
94f1ca4279 Remove future test (#249) 2024-11-01 19:00:02 -04:00
Chenlei Hu
d3f1b9b125 0.8.14 (#253) 2024-10-31 21:57:13 -04:00