mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-01 19:20:10 +00:00
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
This commit is contained in:
@@ -24,7 +24,6 @@ import { LGraphNode, type NodeId } from "./LGraphNode"
|
||||
import { LiteGraph } from "./litegraph"
|
||||
import { type LinkId, LLink } from "./LLink"
|
||||
import { MapProxyHandler } from "./MapProxyHandler"
|
||||
import { isSortaInsideOctagon } from "./measure"
|
||||
import { Reroute, RerouteId } from "./Reroute"
|
||||
import { stringOrEmpty } from "./strings"
|
||||
import { LGraphEventMode } from "./types/globalEnums"
|
||||
@@ -1001,12 +1000,9 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
|
||||
* @param y Y co-ordinate in graph space
|
||||
* @returns The first reroute under the given co-ordinates, or undefined
|
||||
*/
|
||||
getRerouteOnPos(x: number, y: number): Reroute | undefined {
|
||||
for (const reroute of this.reroutes.values()) {
|
||||
const { pos } = reroute
|
||||
|
||||
if (isSortaInsideOctagon(x - pos[0], y - pos[1], 2 * Reroute.radius))
|
||||
return reroute
|
||||
getRerouteOnPos(x: number, y: number, reroutes?: Iterable<Reroute>): Reroute | undefined {
|
||||
for (const reroute of reroutes ?? this.reroutes.values()) {
|
||||
if (reroute.containsPoint([x, y])) return reroute
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user