Commit Graph

1651 Commits

Author SHA1 Message Date
filtered
ccbdff0ad1 Fix Rectangle subarray end offset logic (#1021) 2025-05-06 18:10:59 +00:00
filtered
df6e4debb5 Fix widget snap to work with input sockets (#1017) 2025-05-07 02:02:49 +10:00
Comfy Org PR Bot
c7c7547454 0.15.1 (#1020)
Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-06 19:55:15 +10:00
filtered
c6df437662 [CodeHealth] Replace temporary TS conversion widget types (#1019) 2025-05-06 19:53:49 +10:00
filtered
a74df42cce Fix Rectangle.size exception on access (#1013) 2025-05-06 19:28:51 +10:00
filtered
28434e7165 Fix node with any widgets bypasses link validation (#1016)
- Followup on #891
2025-05-06 09:10:35 +00:00
filtered
c344a73739 [API] Export widget classes for downstream use (#1018)
Exports all widget classes.

- BaseSteppedWidget
- BaseWidget
- BooleanWidget
- ButtonWidget
- ComboWidget
- KnobWidget
- NumberWidget
- SliderWidget
- TextWidget
2025-05-06 06:50:17 +10:00
Comfy Org PR Bot
f6101bccae 0.15.0 (#1012)
Minor version increment to 0.15.0

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-05 10:51:30 +10:00
filtered
75df19521b Widget overhaul (#1010)
### Widget text overhaul

#### Current
- Numbers and text overlap
- Combo boxes truncate the value before the label

![image](https://github.com/user-attachments/assets/c991b0b6-879f-4455-92d4-4254ef25b55c)

#### Proposed

**By default, widgets will now truncate their labels before their
values.**


https://github.com/user-attachments/assets/296ea5ab-d2ff-44f2-9139-5d97789e4f12

- Changes the way widget text is rendered, calculated, and truncated
- Truncation now applies in a standard way to the following widgets:
  - Text
  - Combo
  - Number
- Centralises widget draw routines in base class

### Config

```ts
// Truncate **both** widgets and labels evenly
LiteGraph.truncateWidgetTextEvenly = true

// Swap the default from truncating labels before values, to truncating values first (restores legacy behaviour)
// truncateWidgetTextEvenly **must** be `false`.
LiteGraph.truncateWidgetValuesFirst = true
```

### API / interfaces  

- Adds rich `Rectangle` concrete impl., with many methods and helpful
accessors (e.g. `right`, `bottom`)
- Actually _improves_ performance due to switch from Float32Array to
Float64Array
- Impact vs plain Float64Array was not detectable outside of a 2M+
instantiation-loop with random data
  - Lazy `pos` & `size` `subarray` properties
- Adds `ReadOnlySize`
- Adds higher-level text draw functions to abstract the nitty gritty in
a performant way (binary search)

- Resolves Comfy-Org/ComfyUI_frontend/issues/457
2025-05-05 10:48:06 +10:00
Comfy Org PR Bot
406abd7731 0.15.0-3 (#1011)
Prerelease version increment to 0.15.0-3

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-05 09:01:05 +10:00
filtered
386f18a1e5 Remove DragAndScale rounding when using trackpad (#1009)
Fixes issue where pinch to zoom would jitter around scale 1 - D&S rounds
the value to exactly 1 when it is "close enough". Good for pointer, poor
UX for precision trackpad.
2025-05-04 21:06:43 +00:00
Comfy Org PR Bot
53f766af3d 0.15.0-2 (#1008)
Prerelease version increment to 0.15.0-2

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-04 12:00:10 +10:00
filtered
81eed7a1fa Add macOS trackpad gesture support (#1007)
Adds trackpad gesture support to canvas interaction.  Supports:

- Pinch to zoom
- Two-finger panning

Feature is off by default. Also by default, the browser user-agent must
include "Mac" (even if the feature has been enabled).

```ts
// Enable mac trackpad gestures
LiteGraph.macTrackpadGestures = true

// Disable the default Mac user-agent check
LiteGraph.macGesturesRequireMac = false
```
2025-05-04 11:58:24 +10:00
filtered
bfc87af9d1 [TS] Force explicit override & property access (#1006)
Enables TypeScript rules that improve code legibility.

- Requires `override` keyword
- Prevent indexed properties from being accessed with dot notation

```ts
const obj: Record<string, unknown> = {}

// Prefer
obj["property"]

// Over
obj.property
```
2025-05-03 20:37:01 +00:00
filtered
f2eafae82d Add no-items-selected event (#1004)
Emits an event when attempting to delete items with nothing selected.
Event is generic and should also be used to report any other
user-initiated actions.

Emitted from LGraphCanvas.canvas
- bubbles
- non-cancellable

```
litegraph:no-items-selected
```
2025-05-03 13:49:33 +00:00
Comfy Org PR Bot
aa9f2f74b1 0.15.0-1 (#1003)
Prerelease version increment to 0.15.0-1

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-03 08:14:00 +10:00
filtered
27fbc2ea7c [API] Rewrite LGraphCanvas.setGraph for subgraph (#1002)
Code search showed no usage.

Fixes TS type on LGraph.
2025-05-02 22:01:59 +00:00
filtered
9dcc3bf39a [Refactor] Remove redundant code (#1001)
Removes redundant code. After being refactored out of LGraphCanvas, the
class methods were being passed their own properties as params.
2025-05-02 18:06:23 +00:00
Comfy Org PR Bot
b838a70ed2 0.15.0-0 (#998)
Preminor version increment to 0.15.0-0

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-02 00:10:00 +00:00
filtered
199eeae269 Add subgraph skeleton classes (#997)
Allows downstream consumers to use subgraph types ahead of impl.
2025-05-01 23:16:19 +00:00
filtered
ee89fc575f [Cleanup] Removes unused code (#996)
- Removes unused code
- Removes unnecessary globalAlpha reset when drawing reroute highlight
2025-05-01 22:38:54 +00:00
filtered
cb6020dfc1 [Perf] Prefer set over array.includes (#995)
Simplifies code and improves performance.
2025-05-01 22:31:51 +00:00
filtered
388a3d64cc [Refactor] Split node slot code out to base class (#994)
Foundational work for subgraph.
2025-05-01 22:26:25 +00:00
filtered
2e0267105e [chore] Update typescript package (#993)
v5.8.2 -> v5.8.3
2025-05-01 22:19:50 +00:00
Comfy Org PR Bot
7a9b23087e 0.14.6 (#992)
Patch version increment to 0.14.6

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-02 05:57:12 +10:00
filtered
c4b4b84b41 Fix combo widget dimming on small / broken lists (#989)
- Disables both buttons when there are less than 2 options
- Enables both buttons when combo list values contains error (identical
first and last items).
- Adds deprecation console warning when widget values are passed as a
function
- Fix buttons always dimmed when using legacy values-as-function
- Resolves #984
2025-05-02 05:55:18 +10:00
Comfy Org PR Bot
537cdf7838 0.14.5 (#991)
Patch version increment to 0.14.5

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-02 02:53:21 +10:00
filtered
7d38f6bdc7 Fix regression in legacy widget-values-as-function (#990)
Resolves issue with KJNodes get/set nodes.

![image](https://github.com/user-attachments/assets/ecbf99d4-b2d3-48bf-a34c-65d0bf451b4c)

Downstream consumer:

c3dc82108a/web/js/setgetnodes.js (L401-L404)
2025-05-01 16:50:26 +00:00
Comfy Org PR Bot
cfabeb0821 0.14.4 (#988)
Patch version increment to 0.14.4

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-05-01 10:34:51 +10:00
filtered
0cdee75460 [API] Allow canvas font customisation (#987)
Allows customisation of fonts via `LiteGraph` global var:

```ts
LiteGraph.NODE_FONT = "wingdings"
```


![image](https://github.com/user-attachments/assets/36bec38d-ea5f-4ec6-a2a3-bc5a57826c1e)
2025-05-01 00:19:36 +00:00
filtered
c695b2e2bd Fix LGraph attach/detach canvas silently fails (#986)
Attach would allow duplicate entries.
Detach left the canvas.graph property set, if list_of_graphcanvas was
not set.
2025-04-30 18:10:45 +00:00
filtered
2f0e3d35d3 [CodeHealth] Standardise code in processKey (#985) 2025-04-30 08:23:38 +00:00
filtered
64d1225037 [Refactor] Convert to generic CustomEventTarget (#983)
Converts LinkConnector event target to a generic class.

Subgraph pre-requisite.
2025-04-28 22:19:26 +00:00
filtered
be92f5bdbb [Refactor] Move slot code out of LGraphNode (#981)
Moves collapsed node slot render code to the slot instances.
2025-04-28 17:35:45 +00:00
filtered
ccc588b842 [API] Remove unused: LGraphNode.addConnection (#980)
Confirmed unused via code search
2025-04-28 01:52:53 +00:00
Comfy Org PR Bot
85f677f58c 0.14.3 (#979)
Patch version increment to 0.14.3

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-04-28 05:51:38 +10:00
filtered
ee222c794b Fade invalid increment/decrement widget buttons (#978)
When a widget cannot be incremented/decremented further, show a disabled
effect on the widget buttons.


https://github.com/user-attachments/assets/7770a9f1-31f6-430b-ab02-420327621148
2025-04-28 05:47:48 +10:00
filtered
85b1534263 [API] Send optional pointermove event with onDragStart. (#977)
Sends the `pointermove` event that triggered `onDragStart` with the
callback.

It is possible for no `pointermove` events to occur, but still be far
from the original `pointerdown` event. In this case, `eMove` will be
`undefined`, and `onDragEnd` will be called immediately after
`onDragStart`.
2025-04-27 17:01:38 +00:00
filtered
81a00b5e6c [Refactor] Remove repeat interface definitions (#976)
Prefers param destructuring over manual impl.
2025-04-27 16:30:59 +00:00
filtered
47732404cd Remove Rename Slot option from input sockets (#975)
This menu option was unintentionally inherited from input slots.

- Ref: https://github.com/Comfy-Org/ComfyUI_frontend/issues/3654
2025-04-27 15:47:22 +00:00
filtered
b3d030e36b [API] Add LLink.resolve static / instance methods (#974)
- `LLink.resolve`: Resolves all IDs on the link to their respective
objects (node IDs, slot indexes)
- `LinkNetwork.getLink`: a more concise pattern to resolve links
2025-04-26 20:51:41 +00:00
filtered
8e8818c24d Minor subgraph ts fixes (#973) 2025-04-26 20:34:02 +00:00
filtered
8e414ab133 [Refactor] Abstract legacy link colour properties (#972)
Replaces colour context interface with a simple abstraction object /
interface.
2025-04-26 20:31:43 +00:00
Comfy Org PR Bot
0b46288d32 0.14.2 (#971)
Patch version increment to 0.14.2

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-04-26 17:12:00 +00:00
filtered
5c41e4e09c Add virtual slots to Reroutes (#970)
### Virtual helper "slots"

Adds a virtual input and output slot to native reroutes, allowing links
to be dragged from them to other reroutes or nodes.


https://github.com/user-attachments/assets/67d308c4-4732-4b04-a2b9-0a2b0c79b413

### Notes

- Reroute slots automatically show an outline as the pointer gets close
- When the slot is clickable, it will highlight in the same colour as
the reroute
- Enables opposite direction connecting: from reroute to node outputs
- Floating reroutes only show one slot - to whichever side is not
connected
2025-04-27 03:00:01 +10:00
Comfy Org PR Bot
de0f0ebac1 0.14.1 (#969)
Patch version increment to 0.14.1

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-04-26 02:34:16 +10:00
filtered
38dd58ae23 Fix new link follows pointer until context menu closed (#968)
- Resolves https://github.com/Comfy-Org/ComfyUI_frontend/issues/3618
2025-04-26 02:33:28 +10:00
filtered
c10ce1caa1 [API] Add deprecated warning logging (#967)
Adds a global API to notify devs / users of deprecated features.

- Custom callbacks may be added
- By default, remembers message text and only sends each message once
- Sends to console.warn by default

```ts
// Add a custom notification when a warning is encountered
const warnMessage = (message: string, source?: object) => {
  addToast({ message, detail: object })
}
LiteGraph.onDeprecationWarning.push(warnMessage)
```

```ts
// Debugging flag. Repeats deprecation warnings every time they are reported.
// May impact performance.
LiteGraph.alwaysRepeatWarnings = true
```

Generate a warning
```ts
import { warnDeprecated } from "@/utils/feedback"

warnDeprecated(
  "[DEPRECATED] graph.oldFeature() will be removed from Litegraph. " +
  "Please use graph.newFeature() instead. https://helpful.site/faq",
  objectThatCausedThis
)
```
2025-04-26 02:16:01 +10:00
filtered
63407abf3c Reduce input socket hitbox for widgets (#966)
Restores the full left-arrow button click area for widgets. Previously
lost ~5 canvas pixels to clicks intercepted by input sockets.

Supporting refactors:
- Maps concrete node slot impls. to private array, once per frame
- Converts slot boundingRect to use absolute canvas pos (same as other
elements)
- Stores parent node ref in concrete slot classes
2025-04-25 14:12:09 +00:00
Comfy Org PR Bot
0fd47a767d 0.14.0 (#964)
Minor version increment to 0.14.0

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-04-25 00:33:35 +10:00