mirror of
https://github.com/hanzoai/Hanzo-EasyUse.git
synced 2026-10-30 18:51:27 +00:00
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
import { app } from "../../../../scripts/app.js";
|
|
|
|
|
|
class HUD {
|
|
constructor() {
|
|
this.current_node_id = undefined;
|
|
this.class_of_current_node = null;
|
|
this.current_node_is_chooser = false;
|
|
}
|
|
|
|
update() {
|
|
if (app.runningNodeId==this.current_node_id) return false;
|
|
|
|
this.current_node_id = app.runningNodeId;
|
|
|
|
if (this.current_node_id) {
|
|
this.class_of_current_node = app.graph?._nodes_by_id[app.runningNodeId.toString()]?.comfyClass;
|
|
this.current_node_is_chooser = this.class_of_current_node === "easy imageChooser"
|
|
} else {
|
|
this.class_of_current_node = undefined;
|
|
this.current_node_is_chooser = false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
const hud = new HUD();
|
|
|
|
|
|
class FlowState {
|
|
constructor(){}
|
|
static idle() {
|
|
return (!app.runningNodeId);
|
|
}
|
|
static paused() {
|
|
return true;
|
|
}
|
|
static paused_here(node_id) {
|
|
return (FlowState.paused() && FlowState.here(node_id))
|
|
}
|
|
static running() {
|
|
return (!FlowState.idle());
|
|
}
|
|
static here(node_id) {
|
|
return (app.runningNodeId==node_id);
|
|
}
|
|
static state() {
|
|
if (FlowState.paused()) return "Paused";
|
|
if (FlowState.running()) return "Running";
|
|
return "Idle";
|
|
}
|
|
static cancelling = false;
|
|
}
|
|
|
|
export { hud, FlowState} |