From e899d8bd280bbb88c81b4a41fd7d624194697ef6 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 20 Dec 2014 18:33:35 +0000 Subject: [PATCH] Cursor: Don't draw cursors over each other when they have equal time --- pv/view/cursor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pv/view/cursor.cpp b/pv/view/cursor.cpp index 0ea6f5ab..512b5fa9 100644 --- a/pv/view/cursor.cpp +++ b/pv/view/cursor.cpp @@ -32,8 +32,11 @@ #include #include +#include +using std::abs; using std::shared_ptr; +using std::numeric_limits; namespace pv { namespace view { @@ -72,7 +75,10 @@ QRectF Cursor::label_rect(const QRectF &rect) const TimeMarker::ArrowSize - 0.5f; const float height = label_size.height(); - if (time_ > other->time()) + const double other_time = other->time(); + if (time_ > other_time || + (abs(time_ - other_time) < numeric_limits::epsilon() && + this > other.get())) return QRectF(x, top, label_size.width(), height); else return QRectF(x - label_size.width(), top, -- 2.30.2