Fix app storage

This commit is contained in:
space-nuko
2023-04-28 16:57:42 -07:00
parent 234c280959
commit 079f411a04
5 changed files with 10 additions and 24 deletions

View File

@@ -77,14 +77,6 @@ export default class ComfyApp {
shiftDown: boolean = false;
selectedGroupMoving: boolean = false;
private static _instance: ComfyApp;
static get instance(): ComfyApp {
if (!ComfyApp._instance)
ComfyApp._instance = new ComfyApp()
return ComfyApp._instance
}
private queueItems: QueueItem[] = [];
private processingQueue: boolean = false;

View File

@@ -1,7 +1,9 @@
import { writable } from 'svelte/store';
import type { Readable, Writable } from 'svelte/store';
import type ComfyApp from "$lib/components/ComfyApp"
export type UIState = {
app: ComfyApp,
nodesLocked: boolean,
graphLocked: boolean,
unlocked: boolean,

View File

@@ -4,11 +4,15 @@
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
import ComfyGraphCanvas from "$lib/ComfyGraphCanvas";
import { onMount } from 'svelte';
import uiState from "$lib/stores/uiState"
const app: ComfyApp = ComfyApp.instance;
let app: ComfyApp | null = null;
let lCanvas: LGraphCanvas | null = null;
let canvasEl: HTMLCanvasElement | null = null;
$: if (!app)
app = $uiState.app
function resizeCanvas() {
canvasEl.width = canvasEl.parentElement.offsetWidth;
canvasEl.height = canvasEl.parentElement.offsetHeight;

View File

@@ -18,17 +18,6 @@
let app: ComfyApp | null = null;
function onBackKeyDown(e) {
if(f7.view.current.router.currentRoute.path == '/'){
// exitApp();
e.preventDefault();
} else {
f7.dialog.close()
f7.view.main.router.back()
return false;
}
}
let serializedPaneOrder = {};
function serializeAppState(): SerializedAppState {
@@ -56,7 +45,7 @@
onMount(async () => {
if (app)
return
app = ComfyApp.instance;
app = $uiState.app = new ComfyApp();
// TODO dedup
app.eventBus.on("nodeAdded", nodeState.nodeAdded);

View File

@@ -21,9 +21,8 @@
export let subworkflowID: number = -1;
let app: ComfyApp = undefined;
$: if (ComfyApp.instance)
app = ComfyApp.instance;
$: if (!app)
app = $uiState.app
function queuePrompt() {
app.queuePrompt(0, 1);