]> sigrok.org Git - pulseview.git/commitdiff
pv::view::View::zoom_fit: clamp the scale between MaxScale and MinScale
authorJoel Holdsworth <redacted>
Fri, 17 Jan 2014 18:48:08 +0000 (18:48 +0000)
committerJoel Holdsworth <redacted>
Fri, 17 Jan 2014 18:51:15 +0000 (18:51 +0000)
Fixes #278

pv/view/view.cpp

index cf990bcdced9f7cf44eeac9b149f2942cb8c2cc9..b0e97cb8e04e7df2d5ae558fe92ddcac0ed6c7f7 100644 (file)
@@ -169,7 +169,8 @@ void View::zoom_fit()
        if (w <= 0)
                return;
 
-       set_scale_offset(delta / w, extents.first);
+       const double scale = max(min(delta / w, MaxScale), MinScale);
+       set_scale_offset(scale, extents.first);
 }
 
 void View::zoom_one_to_one()