mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-07 08:30:06 +00:00
Support dragging reroutes from floating links (#878)
Allows dragging reroutes from floating links.
This commit is contained in:
@@ -1250,7 +1250,10 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
|
||||
const linkIds = before instanceof Reroute
|
||||
? before.linkIds
|
||||
: [before.id]
|
||||
const reroute = new Reroute(rerouteId, this, pos, before.parentId, linkIds)
|
||||
const floatingLinkIds = before instanceof Reroute
|
||||
? before.floatingLinkIds
|
||||
: [before.id]
|
||||
const reroute = new Reroute(rerouteId, this, pos, before.parentId, linkIds, floatingLinkIds)
|
||||
this.reroutes.set(rerouteId, reroute)
|
||||
for (const linkId of linkIds) {
|
||||
const link = this._links.get(linkId)
|
||||
@@ -1263,6 +1266,17 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
|
||||
}
|
||||
}
|
||||
|
||||
for (const linkId of floatingLinkIds) {
|
||||
const link = this.floatingLinks.get(linkId)
|
||||
if (!link) continue
|
||||
if (link.parentId === before.parentId) link.parentId = rerouteId
|
||||
|
||||
const reroutes = LLink.getReroutes(this, link)
|
||||
for (const x of reroutes.filter(x => x.parentId === before.parentId)) {
|
||||
x.parentId = rerouteId
|
||||
}
|
||||
}
|
||||
|
||||
return reroute
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user