GUI: fix scrollbars not working

This commit is contained in:
tildearrow 2022-05-20 21:57:41 -05:00
parent dacbeed858
commit dca2aec606
2 changed files with 6 additions and 2 deletions

View file

@ -1243,7 +1243,9 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
if (i.macro->vScroll>((i.max-i.min)-i.macro->vZoom)) i.macro->vScroll=(i.max-i.min)-i.macro->vZoom;
}
if (ImGui::ScrollbarEx(scrollbarPos,ImGui::GetID("IMacroVScroll"),ImGuiAxis_Y,&scrollV,availV,contentsV,0)) {
ImGuiID scrollbarID=ImGui::GetID("IMacroVScroll");
ImGui::KeepAliveID(scrollbarID);
if (ImGui::ScrollbarEx(scrollbarPos,scrollbarID,ImGuiAxis_Y,&scrollV,availV,contentsV,0)) {
i.macro->vScroll=(i.max-i.min-i.macro->vZoom)-scrollV;
}
}

View file

@ -1349,7 +1349,9 @@ void FurnaceGUI::drawSampleEdit() {
ImS64 availV=round(rectSize.x*sampleZoom);
ImS64 contentsV=MAX(sample->samples,MAX(availV,1));
if (ImGui::ScrollbarEx(ImRect(ImVec2(rectMin.x,rectMax.y),ImVec2(rectMax.x,rectMax.y+ImGui::GetStyle().ScrollbarSize)),ImGui::GetID("sampleScroll"),ImGuiAxis_X,&scrollV,availV,contentsV,0)) {
ImGuiID scrollbarID=ImGui::GetID("sampleScroll");
ImGui::KeepAliveID(scrollbarID);
if (ImGui::ScrollbarEx(ImRect(ImVec2(rectMin.x,rectMax.y),ImVec2(rectMax.x,rectMax.y+ImGui::GetStyle().ScrollbarSize)),scrollbarID,ImGuiAxis_X,&scrollV,availV,contentsV,0)) {
if (!sampleZoomAuto && samplePos!=scrollV) {
samplePos=scrollV;
updateSampleTex=true;