mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
fix: only show promoted widget purple border on source node
The purple outline was incorrectly shown on the SubgraphNode's promoted widget slots. It should only appear on the original node inside the subgraph where the widget was promoted from. - PromotedWidgetSlot.promoted returns false - PromotedDomWidgetAdapter.promoted returns false - Suppress promoted border during delegated draw to concrete widget Amp-Thread-ID: https://ampcode.com/threads/T-019c54b0-4da5-74d1-be45-5e713bb886f9 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -86,7 +86,7 @@ export class PromotedDomWidgetAdapter<
|
||||
}
|
||||
|
||||
get promoted(): boolean {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
get margin(): number {
|
||||
|
||||
@@ -60,10 +60,10 @@ describe('PromotedWidgetSlot', () => {
|
||||
expect(slot.sourceWidgetName).toBe('seed')
|
||||
})
|
||||
|
||||
it('is always promoted', () => {
|
||||
it('is not promoted (purple border only shows on source node)', () => {
|
||||
const subNode = createMockSubgraphNode()
|
||||
const slot = new PromotedWidgetSlot(subNode, '5', 'seed')
|
||||
expect(slot.promoted).toBe(true)
|
||||
expect(slot.promoted).toBe(false)
|
||||
})
|
||||
|
||||
it('has serialize set to false', () => {
|
||||
|
||||
@@ -202,11 +202,7 @@ export class PromotedWidgetSlot
|
||||
}
|
||||
|
||||
override get promoted(): boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override get outline_color(): string {
|
||||
return LiteGraph.WIDGET_PROMOTED_OUTLINE_COLOR
|
||||
return false
|
||||
}
|
||||
|
||||
override get _displayValue(): string {
|
||||
@@ -295,11 +291,18 @@ export class PromotedWidgetSlot
|
||||
|
||||
const concrete = toConcreteWidget(resolved.widget, resolved.node, false)
|
||||
if (concrete) {
|
||||
// Suppress promoted border: the purple outline should only appear on
|
||||
// the source node inside the subgraph, not on the SubgraphNode.
|
||||
const wasPromoted = concrete.promoted
|
||||
concrete.promoted = false
|
||||
|
||||
concrete.computedHeight = this.computedHeight
|
||||
ctx.save()
|
||||
ctx.translate(0, this.y - concrete.y)
|
||||
concrete.drawWidget(ctx, options)
|
||||
ctx.restore()
|
||||
|
||||
concrete.promoted = wasPromoted
|
||||
} else {
|
||||
this.drawWidgetShape(ctx, options)
|
||||
if (options.showText !== false) {
|
||||
|
||||
Reference in New Issue
Block a user