mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-05 05:32:02 +00:00
Auto transforms bugged node pos (#712)
This commit is contained in:
@@ -74,7 +74,10 @@ const zProperties = z
|
|||||||
.passthrough()
|
.passthrough()
|
||||||
|
|
||||||
const zVector2 = z.union([
|
const zVector2 = z.union([
|
||||||
z.object({ 0: z.number(), 1: z.number() }).transform((v) => [v[0], v[1]]),
|
z
|
||||||
|
.object({ 0: z.number(), 1: z.number() })
|
||||||
|
.passthrough()
|
||||||
|
.transform((v) => [v[0], v[1]]),
|
||||||
z.tuple([z.number(), z.number()])
|
z.tuple([z.number(), z.number()])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,23 @@ describe('parseComfyWorkflow', () => {
|
|||||||
workflow.nodes[0].pos = { 0: 3, 1: 4 }
|
workflow.nodes[0].pos = { 0: 3, 1: 4 }
|
||||||
validatedWorkflow = await validateComfyWorkflow(workflow)
|
validatedWorkflow = await validateComfyWorkflow(workflow)
|
||||||
expect(validatedWorkflow.nodes[0].pos).toEqual([3, 4])
|
expect(validatedWorkflow.nodes[0].pos).toEqual([3, 4])
|
||||||
|
|
||||||
|
// Should accept the legacy bugged format object.
|
||||||
|
// https://github.com/Comfy-Org/ComfyUI_frontend/issues/710
|
||||||
|
workflow.nodes[0].pos = {
|
||||||
|
'0': 600,
|
||||||
|
'1': 340,
|
||||||
|
'2': 0,
|
||||||
|
'3': 0,
|
||||||
|
'4': 0,
|
||||||
|
'5': 0,
|
||||||
|
'6': 0,
|
||||||
|
'7': 0,
|
||||||
|
'8': 0,
|
||||||
|
'9': 0
|
||||||
|
}
|
||||||
|
validatedWorkflow = await validateComfyWorkflow(workflow)
|
||||||
|
expect(validatedWorkflow.nodes[0].pos).toEqual([600, 340])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('workflow.nodes.widget_values', async () => {
|
it('workflow.nodes.widget_values', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user