GUI: ins edit disable scroll if no scroll range

This commit is contained in:
tildearrow 2023-02-01 14:33:41 -05:00
parent 1dec8bff40
commit 9bf38e02ca
1 changed files with 4 additions and 0 deletions

View File

@ -1791,11 +1791,13 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros, FurnaceGUI
if (macroDragScroll>scrollMax) { if (macroDragScroll>scrollMax) {
macroDragScroll=scrollMax; macroDragScroll=scrollMax;
} }
ImGui::BeginDisabled(scrollMax<1);
ImGui::SetNextItemWidth(availableWidth); ImGui::SetNextItemWidth(availableWidth);
if (CWSliderInt("##MacroScroll",&macroDragScroll,0,scrollMax,"")) { if (CWSliderInt("##MacroScroll",&macroDragScroll,0,scrollMax,"")) {
if (macroDragScroll<0) macroDragScroll=0; if (macroDragScroll<0) macroDragScroll=0;
if (macroDragScroll>scrollMax) macroDragScroll=scrollMax; if (macroDragScroll>scrollMax) macroDragScroll=scrollMax;
} }
ImGui::EndDisabled();
// draw macros // draw macros
for (FurnaceGUIMacroDesc& i: macros) { for (FurnaceGUIMacroDesc& i: macros) {
@ -1844,11 +1846,13 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros, FurnaceGUI
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::BeginDisabled(scrollMax<1);
ImGui::SetNextItemWidth(availableWidth); ImGui::SetNextItemWidth(availableWidth);
if (CWSliderInt("##MacroScroll",&macroDragScroll,0,scrollMax,"")) { if (CWSliderInt("##MacroScroll",&macroDragScroll,0,scrollMax,"")) {
if (macroDragScroll<0) macroDragScroll=0; if (macroDragScroll<0) macroDragScroll=0;
if (macroDragScroll>scrollMax) macroDragScroll=scrollMax; if (macroDragScroll>scrollMax) macroDragScroll=scrollMax;
} }
ImGui::EndDisabled();
ImGui::EndTable(); ImGui::EndTable();
} }
break; break;