[libshumate] view: Fix bug when zooming in/out



commit ebff3e63ffa20a2165dae68e0a77a93a30af4a4e
Author: James Westman <james flyingpimonster net>
Date:   Tue Sep 22 15:36:57 2020 -0500

    view: Fix bug when zooming in/out
    
    The zoom_in function had a guard preventing from zooming when already at level
    0 (which would cause an underflow), but this guard needs to be in zoom_out
    instead.
    
    Fixes bugs where, when you're all the way zoomed out, 1) you can't zoom in, and
    2) you can zoom out and it will wrap around to the highest zoom level.

 shumate/shumate-viewport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/shumate/shumate-viewport.c b/shumate/shumate-viewport.c
index 31111c6..894e871 100644
--- a/shumate/shumate-viewport.c
+++ b/shumate/shumate-viewport.c
@@ -404,9 +404,6 @@ void shumate_viewport_zoom_in (ShumateViewport *self)
 {
   g_return_if_fail (SHUMATE_IS_VIEWPORT (self));
 
-  if (self->zoom_level == 0)
-    return;
-
   shumate_viewport_set_zoom_level (self, self->zoom_level + 1);
 }
 
@@ -420,6 +417,9 @@ void shumate_viewport_zoom_out (ShumateViewport *self)
 {
   g_return_if_fail (SHUMATE_IS_VIEWPORT (self));
 
+  if (self->zoom_level == 0)
+    return;
+
   shumate_viewport_set_zoom_level (self, self->zoom_level - 1);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]