Add Shift+scrollwheel to move left/right in the timeline.
authorCarl Hetherington <cth@carlh.net>
Tue, 27 Feb 2024 00:11:52 +0000 (01:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 27 Feb 2024 00:11:57 +0000 (01:11 +0100)
src/wx/timeline.cc

index f67bf52dc4ffaf971129a0195a4a27af48843288..38e9de4ee46318ca73bfff98a29023c64bac5047 100644 (file)
@@ -136,8 +136,9 @@ Timeline::Timeline(wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film, Fi
 void
 Timeline::mouse_wheel_turned(wxMouseEvent& event)
 {
+       auto const rotation = event.GetWheelRotation();
+
        if (event.ControlDown()) {
-               auto const rotation = event.GetWheelRotation();
                /* On my mouse one click of the scroll wheel is 120, and it's -ve when
                 * scrolling the wheel towards me.
                 */
@@ -166,6 +167,12 @@ Timeline::mouse_wheel_turned(wxMouseEvent& event)
                        _last_mouse_wheel_x = event.GetX();
                        _last_mouse_wheel_time = before_pos;
                }
+       } else if (event.ShiftDown()) {
+               int before_start_x;
+               int before_start_y;
+               _main_canvas->GetViewStart(&before_start_x, &before_start_y);
+               auto const width = _main_canvas->GetSize().GetWidth();
+               _main_canvas->Scroll(std::max(0.0, before_start_x - rotation * 100.0 / width), before_start_y);
        }
 }