mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 07:00:23 +00:00
Serialize to node pos/size to plain array (#273)
This commit is contained in:
@@ -426,8 +426,8 @@ export class LGraphNode implements Positionable {
|
||||
const o: ISerialisedNode = {
|
||||
id: this.id,
|
||||
type: this.type,
|
||||
pos: this.pos,
|
||||
size: this.size,
|
||||
pos: [this.pos[0], this.pos[1]],
|
||||
size: [this.size[0], this.size[1]],
|
||||
flags: LiteGraph.cloneObject(this.flags),
|
||||
order: this.order,
|
||||
mode: this.mode,
|
||||
|
||||
@@ -3,11 +3,14 @@ import {
|
||||
} from "../src/litegraph"
|
||||
|
||||
describe("LGraphNode", () => {
|
||||
it("should serialize position correctly", () => {
|
||||
it("should serialize position/size correctly", () => {
|
||||
const node = new LGraphNode("TestNode")
|
||||
node.pos = [10, 10]
|
||||
expect(node.pos).toEqual(new Float32Array([10, 10]))
|
||||
expect(node.serialize().pos).toEqual(new Float32Array([10, 10]))
|
||||
})
|
||||
expect(node.serialize().pos).toEqual([10, 10])
|
||||
|
||||
node.size = [100, 100]
|
||||
expect(node.size).toEqual(new Float32Array([100, 100]))
|
||||
expect(node.serialize().size).toEqual([100, 100])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user