From: Joel Holdsworth Date: Fri, 17 Jan 2014 18:48:08 +0000 (+0000) Subject: pv::view::View::zoom_fit: clamp the scale between MaxScale and MinScale X-Git-Tag: pulseview-0.2.0~142 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=7831112753a3a419e328d7d6b0d474435a09d6ed pv::view::View::zoom_fit: clamp the scale between MaxScale and MinScale Fixes #278 --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index cf990bcd..b0e97cb8 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -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()