Mercurial > octave-nkf
comparison libinterp/dldfcn/__init_fltk__.cc @ 19901: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 |
comparison
equal
deleted
inserted
replaced
19900:726df008104d | 19901:6ba3d0f7c6e8 |
---|---|
1586 | 1586 |
1587 // Control how fast to zoom when using scroll wheel. | 1587 // Control how fast to zoom when using scroll wheel. |
1588 double wheel_zoom_speed = ap.get_mousewheelzoom (); | 1588 double wheel_zoom_speed = ap.get_mousewheelzoom (); |
1589 | 1589 |
1590 // Determine if we're zooming in or out. | 1590 // Determine if we're zooming in or out. |
1591 const double factor = | 1591 const double factor = (Fl::event_dy () < 0 |
1592 (Fl::event_dy () > 0) ? 1 / (1.0 - wheel_zoom_speed) | 1592 ? 1 / (1.0 - wheel_zoom_speed) |
1593 : 1.0 - wheel_zoom_speed; | 1593 : 1.0 - wheel_zoom_speed); |
1594 | |
1594 | 1595 |
1595 // Get the point we're zooming about. | 1596 // Get the point we're zooming about. |
1596 double x1, y1; | 1597 double x1, y1; |
1597 pixel2pos (ax, Fl::event_x (), Fl::event_y () - menu_dy (), | 1598 pixel2pos (ax, Fl::event_x (), Fl::event_y () - menu_dy (), |
1598 x1, y1); | 1599 x1, y1); |
1600 | |
1601 // FIXME: should we only zoom about point for 2D plots? | |
1599 | 1602 |
1600 ap.zoom_about_point ("both", x1, y1, factor, false); | 1603 ap.zoom_about_point ("both", x1, y1, factor, false); |
1601 mark_modified (); | 1604 mark_modified (); |
1602 return 1; | 1605 return 1; |
1603 } | 1606 } |