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:
Alexander Brown
2026-02-12 17:57:38 -08:00
parent 13d237d6c5
commit b4a5462cbd
3 changed files with 11 additions and 8 deletions

View File

@@ -86,7 +86,7 @@ export class PromotedDomWidgetAdapter<
}
get promoted(): boolean {
return true
return false
}
get margin(): number {

View File

@@ -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', () => {

View File

@@ -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) {