more attempts to kill those imgs
This commit is contained in:
+14
-1
@@ -1,7 +1,7 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
import { api } from "../../scripts/api.js";
|
||||
|
||||
import { create, sound_maker } from "./utils.js";
|
||||
import { create, sound_maker, supress_preview_image } from "./utils.js";
|
||||
import { popup } from "./popup.js";
|
||||
import { Log } from "./log.js";
|
||||
import { setup_mask_events } from "./mask_utils.js";
|
||||
@@ -145,9 +145,22 @@ app.registerExtension({
|
||||
}
|
||||
}
|
||||
},
|
||||
afterConfigureGraph() {
|
||||
setTimeout(run_soon_after_configure, 1000)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function run_soon_after_configure() {
|
||||
try {
|
||||
app.graph.nodes
|
||||
.filter((node)=>FILTER_TYPES.includes(node.type))
|
||||
.forEach(node => supress_preview_image(node) )
|
||||
} catch {
|
||||
let checkpoint_be_here
|
||||
}
|
||||
}
|
||||
|
||||
function set_graph_id_widget(node) {
|
||||
const graph_id_widget = node.widgets?.find((n)=>n.name=='graph_id')
|
||||
if (graph_id_widget) {
|
||||
|
||||
+10
-8
@@ -18,6 +18,7 @@ export function supress_preview_image(node) {
|
||||
if (!app.ui.settings.getSettingValue("Image Filter.UI.Supress Preview")) return
|
||||
if (running_nodes2()) remove_preview_nodes2(node)
|
||||
else remove_preview_nodes1(node)
|
||||
node.imgs = []
|
||||
}
|
||||
|
||||
// probably works for Nodes 1
|
||||
@@ -34,14 +35,15 @@ function remove_preview_nodes1(node, previous_tries=0, delay=50) {
|
||||
}
|
||||
|
||||
function remove_preview_nodes2(node) {
|
||||
if (!node.imgs) return
|
||||
const el = document.querySelector(`[data-node-id="${node.id}"]`)?.querySelector(`.image-preview`)
|
||||
if (el) {
|
||||
el.style.display = "none"
|
||||
el.style.height = "0px"
|
||||
} else {
|
||||
console.log(`Couldn't find an image element on ${node.id}`)
|
||||
}
|
||||
if (node.imgs) {
|
||||
const el = document.querySelector(`[data-node-id="${node.id}"]`)?.querySelector(`.image-preview`)
|
||||
if (el) {
|
||||
el.style.display = "none"
|
||||
el.style.height = "0px"
|
||||
} else {
|
||||
console.log(`Couldn't find an image element on ${node.id}`)
|
||||
}
|
||||
}
|
||||
node.setSize(node.computeSize())
|
||||
app.graph.setDirtyCanvas(true, true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user