diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-26 06:54:58 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-26 07:07:50 +0200 |
commit | 869ada0bca37aafc9a803f3226458f163db5f3c8 (patch) | |
tree | 898a9da087afae35ce04d69cdf8778dfefe04d3b /spline-widget/spline-widget.hpp | |
parent | db0d7e4ca4288e189a65e1c8e38d196dace0a315 (diff) |
spline-widget: fix logic for detecting points being too close
It was still possible to reorder points by dragging one of them.
Also get rid of the iteration. It was previously introduced to
try converge one of the points to another position.
Allow for changing Y value while the point is dragged.
Take snap into account.
Use newly introduced "iround<t>".
Diffstat (limited to 'spline-widget/spline-widget.hpp')
-rw-r--r-- | spline-widget/spline-widget.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/spline-widget/spline-widget.hpp b/spline-widget/spline-widget.hpp index d94d2e8e..8886016c 100644 --- a/spline-widget/spline-widget.hpp +++ b/spline-widget/spline-widget.hpp @@ -56,6 +56,7 @@ protected slots: void mouseReleaseEvent(QMouseEvent *e) override; void reload_spline(); private: + int get_closeness_limit(); void show_tooltip(const QPoint& pos, const QPointF& value = QPointF(0, 0), const QString& prefix = QStringLiteral("")); bool is_in_bounds(const QPoint& pos) const; @@ -67,7 +68,7 @@ private: void focusOutEvent(QFocusEvent*e) override; void resizeEvent(QResizeEvent *) override; -private: + bool is_on_pt(const QPoint& pos, int* pt = nullptr); void update_range(); QPointF pixel_coord_to_point(const QPoint& point); @@ -91,5 +92,4 @@ private: static constexpr int line_length_pixels = 3; static constexpr int point_size = 4; - static constexpr int point_closeness_limit = 7; }; |