return _drags;
}
- void maybe_autoscroll (bool, bool);
+ void maybe_autoscroll (bool, bool, bool, bool);
Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
void set_canvas_cursor (Gdk::Cursor*, bool save=false);
return current_page_frames() / 6;
}
+/** @param allow_horiz true to allow horizontal autoscroll, otherwise false.
+ * @param allow_vert true to allow vertical autoscroll, otherwise false.
+ * @param moving_left true if we are moving left, so we only want to autoscroll on the left of the canvas,
+ * otherwise false, so we only want to autoscroll on the right of the canvas.
+ * @param moving_up true if we are moving up, so we only want to autoscroll at the top of the canvas,
+ * otherwise false, so we only want to autoscroll at the bottom of the canvas.
+ */
void
-Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert)
+Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool moving_left, bool moving_up)
{
bool startit = false;
autoscroll_y = 0;
autoscroll_x = 0;
- if (ty < canvas_timebars_vsize && allow_vert) {
+ if (ty < canvas_timebars_vsize && moving_up && allow_vert) {
autoscroll_y = -1;
startit = true;
- } else if (ty > _canvas_height && allow_vert) {
+ } else if (ty > _canvas_height && !moving_up && allow_vert) {
autoscroll_y = 1;
startit = true;
}
}
if (_drags->current_pointer_frame() > rightmost_frame && allow_horiz) {
- if (rightmost_frame < max_framepos) {
+ if (rightmost_frame < max_framepos && !moving_left) {
autoscroll_x = 1;
startit = true;
}
} else if (_drags->current_pointer_frame() < leftmost_frame && allow_horiz) {
- if (leftmost_frame > 0) {
+ if (leftmost_frame > 0 && moving_left) {
autoscroll_x = -1;
startit = true;
}
if (event->motion.state & Gdk::BUTTON1_MASK || event->motion.state & Gdk::BUTTON2_MASK) {
if (!from_autoscroll) {
- _editor->maybe_autoscroll (true, allow_vertical_autoscroll ());
+ bool const moving_left = _drags->current_pointer_x() < _last_pointer_x;
+ bool const moving_up = _drags->current_pointer_y() < _last_pointer_y;
+ _editor->maybe_autoscroll (true, allow_vertical_autoscroll (), moving_left, moving_up);
}
motion (event, _move_threshold_passed != old_move_threshold_passed);
virtual Gtkmm2ext::TearOff* tools_tearoff () const = 0;
virtual DragManager* drags () const = 0;
- virtual void maybe_autoscroll (bool, bool) = 0;
+ virtual void maybe_autoscroll (bool, bool, bool, bool) = 0;
virtual void stop_canvas_autoscroll () = 0;
virtual MouseCursors const * cursors () const = 0;
controls_ebox.translate_coordinates (*control_parent, ev->x, ev->y, tx, ty);
ev->y = ty - _editor.get_trackview_group_vertical_offset();
_editor.drags()->motion_handler ((GdkEvent *) ev, false);
- _editor.maybe_autoscroll (false, true);
+ _editor.maybe_autoscroll (false, true, false, ev->y_root < _resize_drag_start);
/* now do the actual TAV resize */
int32_t const delta = (int32_t) floor (ev->y_root - _resize_drag_start);