window object does weird things, rename root ID

when used with (window as any).app, it uses the element with id #app instead
This commit is contained in:
space-nuko
2023-05-17 21:31:37 -05:00
parent 0cecbee21c
commit 967989494c
15 changed files with 51 additions and 42 deletions

View File

@@ -172,8 +172,6 @@
onMount(async () => {
await app.setup();
(window as any).app = app;
(window as any).appPane = uiPane;
// await import('../../scss/ux.scss');
@@ -185,10 +183,10 @@
}
$: if (uiTheme === "gradio-dark") {
document.getElementById("app").classList.add("dark")
document.getElementById("app-root").classList.add("dark")
}
else {
document.getElementById("app").classList.remove("dark")
document.getElementById("app-root").classList.remove("dark")
}
</script>

View File

@@ -115,7 +115,7 @@ export default class ComfyApp {
this.setupColorScheme()
this.rootEl = document.getElementById("app") as HTMLDivElement;
this.rootEl = document.getElementById("app-root") as HTMLDivElement;
this.canvasEl = document.getElementById("graph-canvas") as HTMLCanvasElement;
this.lGraph = new ComfyGraph();
this.lCanvas = new ComfyGraphCanvas(this, this.canvasEl);

View File

@@ -21,8 +21,8 @@
object_fit: "cover",
height: "auto"
};
export let imageWidth: number = 1;
export let imageHeight: number = 1;
export let imageWidth: number = 0;
export let imageHeight: number = 0;
const dispatch = createEventDispatcher<{
select: SelectData;
@@ -32,8 +32,8 @@
let was_reset: boolean = true;
$: if (selected_image == null || was_reset) {
imageWidth = 1;
imageHeight = 1;
imageWidth = 0;
imageHeight = 0;
}
$: was_reset = value == null || value.length == 0 ? true : was_reset;

View File

@@ -11,8 +11,8 @@
export let label: string | undefined = undefined;
export let show_label: boolean;
export let selectable: boolean = false;
export let imageWidth: number = 1;
export let imageHeight: number = 1;
export let imageWidth: number = 0;
export let imageHeight: number = 0;
let imageElem: HTMLImageElement | null = null;
const dispatch = createEventDispatcher<{
@@ -23,8 +23,8 @@
$: value && dispatch("change", value);
$: if (value == null || !imageElem) {
imageWidth = 1;
imageHeight = 1;
imageWidth = 0;
imageHeight = 0;
}
const handle_click = (evt: MouseEvent) => {