Fix app storage
This commit is contained in:
@@ -77,14 +77,6 @@ export default class ComfyApp {
|
|||||||
shiftDown: boolean = false;
|
shiftDown: boolean = false;
|
||||||
selectedGroupMoving: 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 queueItems: QueueItem[] = [];
|
||||||
private processingQueue: boolean = false;
|
private processingQueue: boolean = false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import type { Readable, Writable } from 'svelte/store';
|
import type { Readable, Writable } from 'svelte/store';
|
||||||
|
import type ComfyApp from "$lib/components/ComfyApp"
|
||||||
|
|
||||||
export type UIState = {
|
export type UIState = {
|
||||||
|
app: ComfyApp,
|
||||||
nodesLocked: boolean,
|
nodesLocked: boolean,
|
||||||
graphLocked: boolean,
|
graphLocked: boolean,
|
||||||
unlocked: boolean,
|
unlocked: boolean,
|
||||||
|
|||||||
@@ -4,11 +4,15 @@
|
|||||||
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
|
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
|
||||||
import ComfyGraphCanvas from "$lib/ComfyGraphCanvas";
|
import ComfyGraphCanvas from "$lib/ComfyGraphCanvas";
|
||||||
import { onMount } from 'svelte';
|
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 lCanvas: LGraphCanvas | null = null;
|
||||||
let canvasEl: HTMLCanvasElement | null = null;
|
let canvasEl: HTMLCanvasElement | null = null;
|
||||||
|
|
||||||
|
$: if (!app)
|
||||||
|
app = $uiState.app
|
||||||
|
|
||||||
function resizeCanvas() {
|
function resizeCanvas() {
|
||||||
canvasEl.width = canvasEl.parentElement.offsetWidth;
|
canvasEl.width = canvasEl.parentElement.offsetWidth;
|
||||||
canvasEl.height = canvasEl.parentElement.offsetHeight;
|
canvasEl.height = canvasEl.parentElement.offsetHeight;
|
||||||
|
|||||||
@@ -18,17 +18,6 @@
|
|||||||
|
|
||||||
let app: ComfyApp | null = null;
|
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 = {};
|
let serializedPaneOrder = {};
|
||||||
|
|
||||||
function serializeAppState(): SerializedAppState {
|
function serializeAppState(): SerializedAppState {
|
||||||
@@ -56,7 +45,7 @@
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (app)
|
if (app)
|
||||||
return
|
return
|
||||||
app = ComfyApp.instance;
|
app = $uiState.app = new ComfyApp();
|
||||||
|
|
||||||
// TODO dedup
|
// TODO dedup
|
||||||
app.eventBus.on("nodeAdded", nodeState.nodeAdded);
|
app.eventBus.on("nodeAdded", nodeState.nodeAdded);
|
||||||
|
|||||||
@@ -21,9 +21,8 @@
|
|||||||
export let subworkflowID: number = -1;
|
export let subworkflowID: number = -1;
|
||||||
let app: ComfyApp = undefined;
|
let app: ComfyApp = undefined;
|
||||||
|
|
||||||
$: if (ComfyApp.instance)
|
$: if (!app)
|
||||||
app = ComfyApp.instance;
|
app = $uiState.app
|
||||||
|
|
||||||
|
|
||||||
function queuePrompt() {
|
function queuePrompt() {
|
||||||
app.queuePrompt(0, 1);
|
app.queuePrompt(0, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user