mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-09 07:00:06 +00:00
allow dragging out links and creating connections
This commit is contained in:
@@ -87,6 +87,7 @@ import type { PickNevers } from './types/utility'
|
||||
import type { IBaseWidget } from './types/widgets'
|
||||
import { alignNodes, distributeNodes, getBoundaryNodes } from './utils/arrange'
|
||||
import { findFirstNode, getAllNestedItems } from './utils/collections'
|
||||
import { resolveConnectingLinkColor } from './utils/linkColors'
|
||||
import type { UUID } from './utils/uuid'
|
||||
import { BaseWidget } from './widgets/BaseWidget'
|
||||
import { toConcreteWidget } from './widgets/widgetMap'
|
||||
@@ -4717,10 +4718,7 @@ export class LGraphCanvas
|
||||
const connShape = fromSlot.shape
|
||||
const connType = fromSlot.type
|
||||
|
||||
const colour =
|
||||
connType === LiteGraph.EVENT
|
||||
? LiteGraph.EVENT_LINK_COLOR
|
||||
: LiteGraph.CONNECTING_LINK_COLOR
|
||||
const colour = resolveConnectingLinkColor(connType)
|
||||
|
||||
// the connection being dragged by the mouse
|
||||
if (this.linkRenderer) {
|
||||
|
||||
13
src/lib/litegraph/src/utils/linkColors.ts
Normal file
13
src/lib/litegraph/src/utils/linkColors.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { CanvasColour, ISlotType } from '../interfaces'
|
||||
import { LiteGraph } from '../litegraph'
|
||||
|
||||
/**
|
||||
* Resolve the colour used while rendering or previewing a connection of a given slot type.
|
||||
*/
|
||||
export function resolveConnectingLinkColor(
|
||||
type: ISlotType | undefined
|
||||
): CanvasColour {
|
||||
return type === LiteGraph.EVENT
|
||||
? LiteGraph.EVENT_LINK_COLOR
|
||||
: LiteGraph.CONNECTING_LINK_COLOR
|
||||
}
|
||||
Reference in New Issue
Block a user