From 201f3ff0f84410f4ec01926ab85aa133bcfda921 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 23 Nov 2022 03:40:59 -0500 Subject: [PATCH] GUI: more natural sample zooming --- src/gui/sampleEdit.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui/sampleEdit.cpp b/src/gui/sampleEdit.cpp index 6d5032368..077732ddb 100644 --- a/src/gui/sampleEdit.cpp +++ b/src/gui/sampleEdit.cpp @@ -882,7 +882,6 @@ void FurnaceGUI::drawSampleEdit() { } if (ImGui::IsItemActive()) { - logV("item is active..."); if (ImGui::GetMousePos().x>rectMax.x) { double delta=pow(MAX(1.0,(ImGui::GetMousePos().x-rectMax.x)*0.04),2.0); samplePos+=MAX(1.0,sampleZoom*delta); @@ -964,11 +963,18 @@ void FurnaceGUI::drawSampleEdit() { if (ImGui::IsItemHovered()) { if (ctrlWheeling) { double zoomPercent=100.0/sampleZoom; - zoomPercent+=wheelY*10.0; + if (wheelY>0) { + for (int i=0; i10000.0) zoomPercent=10000.0; - if (zoomPercent<1.0) zoomPercent=1.0; + if (zoomPercent<0.01) zoomPercent=0.01; sampleZoom=100.0/zoomPercent; - if (sampleZoom<0.01) sampleZoom=0.01; sampleZoomAuto=false; int bounds=((int)sample->samples-round(rectSize.x*sampleZoom)); if (bounds<0) bounds=0;