From 04ce4c3583c7f1f390a20c15511c05d1cf0403b8 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Mon, 30 Aug 2021 02:27:48 +0200 Subject: [PATCH] Make the zoom slider increase exponentially --- core/src/gui/main_window.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 1734864a..d99ffba3 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -598,8 +598,14 @@ void MainWindow::draw() { ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Zoom").x / 2.0)); ImGui::Text("Zoom"); ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10); - if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, gui::waterfall.getBandwidth(), 1000.0, "")) { - gui::waterfall.setViewBandwidth(bw); + float minSliderBw = 1000.0; + float maxSliderBw = gui::waterfall.getBandwidth(); + if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, maxSliderBw, minSliderBw, "")) { + float normBw = bw / (maxSliderBw - minSliderBw); + float factor = normBw * normBw; + float finalBw = minSliderBw + bw * factor; + + gui::waterfall.setViewBandwidth(finalBw); if (vfo != NULL) { gui::waterfall.setViewOffset(vfo->centerOffset); // center vfo on screen }