mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
Prevent user from enabling view if no room on screen.
This commit is contained in:
parent
d05e6b9455
commit
93fd33d69c
@ -1217,11 +1217,16 @@ async function extraNetworksControlTreeViewOnClick(event) {
|
|||||||
const btn = event.target.closest(".extra-network-control--tree-view");
|
const btn = event.target.closest(".extra-network-control--tree-view");
|
||||||
const controls = btn.closest(".extra-network-controls");
|
const controls = btn.closest(".extra-network-controls");
|
||||||
const tab = extra_networks_tabs[controls.dataset.tabnameFull];
|
const tab = extra_networks_tabs[controls.dataset.tabnameFull];
|
||||||
btn.toggleAttribute("data-selected");
|
|
||||||
tab.tree_view_en = "selected" in btn.dataset;
|
|
||||||
|
|
||||||
const div_tree = tab.container_elem.querySelector(".extra-network-content--tree-view");
|
const div_tree = tab.container_elem.querySelector(".extra-network-content--tree-view");
|
||||||
tab.resize_grid.toggle({elem: div_tree, override: tab.tree_view_en});
|
try {
|
||||||
|
tab.resize_grid.toggle({elem: div_tree, override: !("selected" in btn.dataset)});
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Error attempting to enable tree_view:", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
btn.toggleAttribute("data-selected");
|
||||||
|
tab.tree_view_en = "selected" in btn.dataset;
|
||||||
tab.tree_list.enable(tab.tree_view_en);
|
tab.tree_list.enable(tab.tree_view_en);
|
||||||
|
|
||||||
// If the tree list hasn't loaded yet, we need to force it to load.
|
// If the tree list hasn't loaded yet, we need to force it to load.
|
||||||
@ -1242,11 +1247,16 @@ function extraNetworksControlDirsViewOnClick(event) {
|
|||||||
const btn = event.target.closest(".extra-network-control--dirs-view");
|
const btn = event.target.closest(".extra-network-control--dirs-view");
|
||||||
const controls = btn.closest(".extra-network-controls");
|
const controls = btn.closest(".extra-network-controls");
|
||||||
const tab = extra_networks_tabs[controls.dataset.tabnameFull];
|
const tab = extra_networks_tabs[controls.dataset.tabnameFull];
|
||||||
btn.toggleAttribute("data-selected");
|
|
||||||
tab.dirs_view_en = "selected" in btn.dataset;
|
|
||||||
|
|
||||||
const div_dirs = tab.container_elem.querySelector(".extra-network-content--dirs-view");
|
const div_dirs = tab.container_elem.querySelector(".extra-network-content--dirs-view");
|
||||||
tab.resize_grid.toggle({elem: div_dirs, override: tab.dirs_view_en});
|
try {
|
||||||
|
tab.resize_grid.toggle({elem: div_dirs, override: !("selected" in btn.dataset)});
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Error attempting to enable dirs_view:", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
btn.toggleAttribute("data-selected");
|
||||||
|
tab.dirs_view_en = "selected" in btn.dataset;
|
||||||
|
|
||||||
tab.applyListButtonStates();
|
tab.applyListButtonStates();
|
||||||
}
|
}
|
||||||
@ -1259,11 +1269,16 @@ async function extraNetworksControlCardViewOnClick(event) {
|
|||||||
const btn = event.target.closest(".extra-network-control--card-view");
|
const btn = event.target.closest(".extra-network-control--card-view");
|
||||||
const controls = btn.closest(".extra-network-controls");
|
const controls = btn.closest(".extra-network-controls");
|
||||||
const tab = extra_networks_tabs[controls.dataset.tabnameFull];
|
const tab = extra_networks_tabs[controls.dataset.tabnameFull];
|
||||||
btn.toggleAttribute("data-selected");
|
|
||||||
tab.card_view_en = "selected" in btn.dataset;
|
|
||||||
|
|
||||||
const div_card = tab.container_elem.querySelector(".extra-network-content--card-view");
|
const div_card = tab.container_elem.querySelector(".extra-network-content--card-view");
|
||||||
tab.resize_grid.toggle({elem: div_card, override: tab.card_view_en});
|
try {
|
||||||
|
tab.resize_grid.toggle({elem: div_card, override: !("selected" in btn.dataset)});
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Error attempting to enable card_view:", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
btn.toggleAttribute("data-selected");
|
||||||
|
tab.card_view_en = "selected" in btn.dataset;
|
||||||
tab.card_list.enable(tab.card_view_en);
|
tab.card_list.enable(tab.card_view_en);
|
||||||
|
|
||||||
// If the tree list hasn't loaded yet, we need to force it to load.
|
// If the tree list hasn't loaded yet, we need to force it to load.
|
||||||
@ -1282,11 +1297,16 @@ function extraNetworksControlDetsViewOnClick(event) {
|
|||||||
const btn = event.target.closest(".extra-network-control--dets-view");
|
const btn = event.target.closest(".extra-network-control--dets-view");
|
||||||
const controls = btn.closest(".extra-network-controls");
|
const controls = btn.closest(".extra-network-controls");
|
||||||
const tab = extra_networks_tabs[controls.dataset.tabnameFull];
|
const tab = extra_networks_tabs[controls.dataset.tabnameFull];
|
||||||
btn.toggleAttribute("data-selected");
|
|
||||||
tab.dets_view_en = "selected" in btn.dataset;
|
|
||||||
|
|
||||||
const div_dets = tab.container_elem.querySelector(".extra-network-content--dets-view");
|
const div_dets = tab.container_elem.querySelector(".extra-network-content--dets-view");
|
||||||
tab.resize_grid.toggle({elem: div_dets, override: tab.dets_view_en});
|
try {
|
||||||
|
tab.resize_grid.toggle({elem: div_dets, override: !("selected" in btn.dataset)});
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Error attempting to enable dets_view:", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
btn.toggleAttribute("data-selected");
|
||||||
|
tab.dets_view_en = "selected" in btn.dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
function extraNetworksControlRefreshOnClick(event) {
|
function extraNetworksControlRefreshOnClick(event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user