Use upper graph in subgraph stack for saved offset/scale
This commit is contained in:
@@ -47,10 +47,16 @@ export default class ComfyGraphCanvas extends LGraphCanvas {
|
|||||||
_selectedNodes: Set<NodeID> = new Set();
|
_selectedNodes: Set<NodeID> = new Set();
|
||||||
|
|
||||||
serialize(): SerializedGraphCanvasState {
|
serialize(): SerializedGraphCanvasState {
|
||||||
return {
|
let offset = this.ds.offset;
|
||||||
offset: this.ds.offset,
|
let scale = this.ds.scale;
|
||||||
scale: this.ds.scale
|
|
||||||
|
// Use top-level graph for saved offset if we're viewing a subgraph
|
||||||
|
if (this._graph_stack?.length > 0) {
|
||||||
|
offset = this._graph_stack[0].offset;
|
||||||
|
scale = this._graph_stack[0].scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return { offset, scale }
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(data: SerializedGraphCanvasState) {
|
deserialize(data: SerializedGraphCanvasState) {
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ export default class ComfyPickImageNode extends ComfyGraphNode {
|
|||||||
this.setOutputData(2, this._image.width);
|
this.setOutputData(2, this._image.width);
|
||||||
this.setOutputData(3, this._image.height);
|
this.setOutputData(3, this._image.height);
|
||||||
|
|
||||||
|
// XXX: image size doesn't load until the <img> element is ready on
|
||||||
|
// the page so this can come after several frames' worth of
|
||||||
|
// execution
|
||||||
this.widthWidget.value = this._image.width
|
this.widthWidget.value = this._image.width
|
||||||
this.heightWidget.value = this._image.height
|
this.heightWidget.value = this._image.height
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user