From: Soeren Apel Date: Mon, 28 Dec 2015 20:48:30 +0000 (+0100) Subject: Viewport: Allow for vertical dragging as well X-Git-Tag: pulseview-0.3.0~23 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=838d0522bf01d4e7550f8c124135debd452f0cac;p=pulseview.git Viewport: Allow for vertical dragging as well --- diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 5cb65079..9e136664 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -78,6 +78,7 @@ void Viewport::item_hover(const shared_ptr &item) void Viewport::drag() { drag_offset_ = view_.offset(); + drag_v_offset_ = view_.owner_visual_v_offset(); } void Viewport::drag_by(const QPoint &delta) @@ -87,6 +88,8 @@ void Viewport::drag_by(const QPoint &delta) view_.set_scale_offset(view_.scale(), (*drag_offset_ - delta.x() * view_.scale())); + + view_.set_v_offset(-drag_v_offset_ - delta.y()); } void Viewport::drag_release() diff --git a/pv/view/viewport.hpp b/pv/view/viewport.hpp index c2c42d15..704e7311 100644 --- a/pv/view/viewport.hpp +++ b/pv/view/viewport.hpp @@ -97,6 +97,7 @@ private: private: boost::optional drag_offset_; + int drag_v_offset_; double pinch_offset0_; double pinch_offset1_;