mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 07:14:11 +00:00
Improve slot render stability & perf (#954)
- `draw` is now skipped for slots that should not be shown (prev. drawn with 0 alpha) - Fixes slot always rendered when widget not found in `node.widgets` - Remove redundant check from `isWidgetInputSlot` - type is already `INodeInputSlot`
This commit is contained in:
@@ -3493,7 +3493,8 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
||||
return this.#getMouseOverSlot(slot) === slot
|
||||
}
|
||||
|
||||
#isMouseOverWidget(widget: IWidget): boolean {
|
||||
#isMouseOverWidget(widget: IWidget | undefined): boolean {
|
||||
if (!widget) return false
|
||||
return this.mouseOver?.overWidget === widget
|
||||
}
|
||||
|
||||
@@ -3535,19 +3536,20 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
||||
// - the mouse is over the widget
|
||||
// - the slot is valid during link drop
|
||||
// - the slot is connected
|
||||
const showSlot = isMouseOverSlot ||
|
||||
if (
|
||||
isMouseOverSlot ||
|
||||
isValidTarget ||
|
||||
!slotInstance.isWidgetInputSlot ||
|
||||
this.#isMouseOverWidget(this.getWidgetFromSlot(slotInstance)!) ||
|
||||
this.#isMouseOverWidget(this.getWidgetFromSlot(slotInstance)) ||
|
||||
slotInstance.isConnected()
|
||||
|
||||
ctx.globalAlpha = showSlot ? (isValid ? editorAlpha : 0.4 * editorAlpha) : 0
|
||||
|
||||
slotInstance.draw(ctx, {
|
||||
colorContext,
|
||||
lowQuality,
|
||||
highlight,
|
||||
})
|
||||
) {
|
||||
ctx.globalAlpha = isValid ? editorAlpha : 0.4 * editorAlpha
|
||||
slotInstance.draw(ctx, {
|
||||
colorContext,
|
||||
lowQuality,
|
||||
highlight,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user