Add option to swap left click behavior for model details. Fix missing horizontal scrollbar on dets view.

This commit is contained in:
Sj-Si 2024-06-03 13:39:31 -04:00
parent da17f5f84f
commit 5f32eb168d
3 changed files with 13 additions and 1 deletions

View File

@ -1444,6 +1444,12 @@ function extraNetworksCardOnClick(event) {
allow_neg: btn.dataset.allowNeg, allow_neg: btn.dataset.allowNeg,
checkpoint_name: checkpoint_name, checkpoint_name: checkpoint_name,
}); });
// Show details view if user setting is "click".
const left_click_opt = opts.extra_networks_card_details_click_behavior.toLowerCase().trim();
if (left_click_opt === "click") {
tab.showDetsView(btn);
}
} }
function extraNetworksDetsViewCloseOnClick(event) { function extraNetworksDetsViewCloseOnClick(event) {
@ -1467,6 +1473,11 @@ function extraNetworksDetsViewTagOnClick(event) {
} }
function extraNetworksCardOnLongPress(event) { function extraNetworksCardOnLongPress(event) {
const left_click_opt = opts.extra_networks_card_details_click_behavior.toLowerCase().trim();
// Only execute this event if user setting is "long press".
if (left_click_opt !== "long press") {
return;
}
const btn = event.target.closest(".card"); const btn = event.target.closest(".card");
const pane = btn.closest(".extra-network-pane"); const pane = btn.closest(".extra-network-pane");
const tab = extra_networks_tabs[pane.dataset.tabnameFull]; const tab = extra_networks_tabs[pane.dataset.tabnameFull];

View File

@ -255,6 +255,7 @@ options_templates.update(options_section(('extra_networks', "Extra Networks", "s
"extra_networks_show_hidden_models_in_tree_view": OptionInfo(False, "Show entries for models inside hidden directories in the tree view.").info("This option only applies if the \"Show buttons for hidden directories\" option is enabled.").needs_reload_ui(), "extra_networks_show_hidden_models_in_tree_view": OptionInfo(False, "Show entries for models inside hidden directories in the tree view.").info("This option only applies if the \"Show buttons for hidden directories\" option is enabled.").needs_reload_ui(),
"extra_networks_tree_view_expand_depth_default": OptionInfo(0, "Expand all directories in the tree view up to this depth by default.").info("0 collapses all, -1 expands all.").needs_reload_ui(), "extra_networks_tree_view_expand_depth_default": OptionInfo(0, "Expand all directories in the tree view up to this depth by default.").info("0 collapses all, -1 expands all.").needs_reload_ui(),
"extra_networks_directory_filter_click_behavior": OptionInfo("Click", "Filter directory recursively left mouse button action.", gr.Radio, {"choices": ["Click", "Long Press"]}).info("Sets the default left mouse button action required to filter a directory recursively (show children in all subdirectories) vs filtering to only show direct children of the selected directory."), "extra_networks_directory_filter_click_behavior": OptionInfo("Click", "Filter directory recursively left mouse button action.", gr.Radio, {"choices": ["Click", "Long Press"]}).info("Sets the default left mouse button action required to filter a directory recursively (show children in all subdirectories) vs filtering to only show direct children of the selected directory."),
"extra_networks_card_details_click_behavior": OptionInfo("Click", "Show card details left mouse button action.", gr.Radio, {"choices": ["Click", "Long Press"]}).info("Sets the default left mouse button action when clicking a card."),
"extra_networks_default_multiplier": OptionInfo(1.0, "Default multiplier for extra networks", gr.Slider, {"minimum": 0.0, "maximum": 2.0, "step": 0.01}), "extra_networks_default_multiplier": OptionInfo(1.0, "Default multiplier for extra networks", gr.Slider, {"minimum": 0.0, "maximum": 2.0, "step": 0.01}),
"extra_networks_card_width": OptionInfo(0, "Card width for Extra Networks").info("in pixels"), "extra_networks_card_width": OptionInfo(0, "Card width for Extra Networks").info("in pixels"),
"extra_networks_card_height": OptionInfo(0, "Card height for Extra Networks").info("in pixels"), "extra_networks_card_height": OptionInfo(0, "Card height for Extra Networks").info("in pixels"),

View File

@ -1896,7 +1896,7 @@ body.resizing.resize-grid-row {
.extra-network-content--dets-view { .extra-network-content--dets-view {
padding: var(--block-padding); padding: var(--block-padding);
overflow: clip auto; overflow: auto auto;
} }
.extra-network-content--dets-view-model-info { .extra-network-content--dets-view-model-info {