diff libinterp/dldfcn/__init_fltk__.cc @ 19867:6ba3d0f7c6e8

improve mouse zooming for Qt plotting (bug #44302) * Figure.h (enum MouseMode): Split ZoomMode into ZoomInMode and ZoomOutMode. Change all uses. * Canvas.cc (Canvas::canvasMouseReleaseEvent, Canvas::canvasWheelEvent): Make meaning of zoom factor consistent with zoom function. Make direction of wheel event consistent with other programs. * __init_fltk__.cc (plot_window::handle): Make meaning of zoom factor consistent with zoom function. * MouseModeActionGroup.cc (MouseModeActionGroup::MouseModeActionGroup): Provide buttons for zooming in and out. * graphics.cc (figure::properties::set_toolkit): Handle zoom direction. (do_zoom): Make factor > 1 zoom in.
author John W. Eaton <jwe@octave.org>
date Thu, 26 Feb 2015 19:24:59 -0500
parents 19755f4fc851
children d575cd1e0da7
line wrap: on
line diff
--- a/libinterp/dldfcn/__init_fltk__.cc	Thu Feb 26 13:54:11 2015 -0500
+++ b/libinterp/dldfcn/__init_fltk__.cc	Thu Feb 26 19:24:59 2015 -0500
@@ -1588,15 +1588,18 @@
                     double wheel_zoom_speed = ap.get_mousewheelzoom ();
 
                     // Determine if we're zooming in or out.
-                    const double factor =
-                      (Fl::event_dy () > 0) ? 1 / (1.0 - wheel_zoom_speed)
-                      : 1.0 - wheel_zoom_speed;
+                    const double factor = (Fl::event_dy () < 0
+                                           ? 1 / (1.0 - wheel_zoom_speed)
+                                           : 1.0 - wheel_zoom_speed);
+
 
                     // Get the point we're zooming about.
                     double x1, y1;
                     pixel2pos (ax, Fl::event_x (), Fl::event_y () - menu_dy (),
                                x1, y1);
 
+                    // FIXME: should we only zoom about point for 2D plots?
+
                     ap.zoom_about_point ("both", x1, y1, factor, false);
                     mark_modified ();
                     return 1;