mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
fix: clear computedDisabled on concrete widget during promoted slot drawing
The concrete widget created from the interior POJO inherits computedDisabled=true, which suppresses arrow buttons and display values for numeric widgets on the SubgraphNode. Amp-Thread-ID: https://ampcode.com/threads/T-019c5575-c485-767b-a7d1-adccefa4f60e Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -400,6 +400,32 @@ describe('PromotedWidgetSlot', () => {
|
||||
expect(spy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('clears computedDisabled on concrete widget before drawing', () => {
|
||||
const interiorWidget = createMockWidget({ type: 'number' })
|
||||
const interiorNode = {
|
||||
id: '5',
|
||||
widgets: [interiorWidget]
|
||||
} as unknown as LGraphNode
|
||||
const subNode = createMockSubgraphNode({ '5': interiorNode })
|
||||
const slot = new PromotedWidgetSlot(subNode, '5', 'seed')
|
||||
|
||||
const concreteWidget = {
|
||||
y: 0,
|
||||
computedDisabled: true,
|
||||
promoted: true,
|
||||
drawWidget: vi.fn(function (this: { computedDisabled?: boolean }) {
|
||||
expect(this.computedDisabled).toBe(false)
|
||||
})
|
||||
} as unknown as BaseWidget<IBaseWidget>
|
||||
|
||||
vi.mocked(toConcreteWidget).mockReturnValueOnce(concreteWidget)
|
||||
|
||||
const ctx = createMockCtx()
|
||||
slot.drawWidget(ctx, { width: 200, showText: true })
|
||||
|
||||
expect(concreteWidget.drawWidget).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not mutate concrete widget y/last_y during rendering', () => {
|
||||
const interiorWidget = createMockWidget({ type: 'number' })
|
||||
const interiorNode = {
|
||||
|
||||
@@ -259,10 +259,12 @@ export class PromotedWidgetSlot extends BaseWidget<IBaseWidget> {
|
||||
: null
|
||||
|
||||
if (concrete) {
|
||||
// Suppress promoted border: the purple outline should only appear on
|
||||
// the source node inside the subgraph, not on the SubgraphNode.
|
||||
// Suppress promoted border and disabled state: the purple outline and
|
||||
// linked-disabled flag should only apply on the source node inside the
|
||||
// subgraph, not on the SubgraphNode.
|
||||
const wasPromoted = concrete.promoted
|
||||
concrete.promoted = false
|
||||
concrete.computedDisabled = false
|
||||
|
||||
concrete.computedHeight = this.computedHeight
|
||||
ctx.save()
|
||||
|
||||
Reference in New Issue
Block a user