From e6e526c2cb499c06ee67899ccd79b76d68002d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 2 Jan 2017 14:22:32 +0100 Subject: [PATCH] =?UTF-8?q?[apps/regression]=C2=A0Fix=20bug:=20in=20the=20?= =?UTF-8?q?graph=20page,=20correctly=20redraw=20the=20dots=20when=20needed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I23c729003bccaaa91b593b636eee8a49ac6c6ffc --- apps/curve_view.cpp | 4 ++-- apps/regression/graph_view.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/curve_view.cpp b/apps/curve_view.cpp index d547e8df0..b0c12d642 100644 --- a/apps/curve_view.cpp +++ b/apps/curve_view.cpp @@ -150,8 +150,8 @@ void CurveView::drawSegment(KDContext * ctx, KDRect rect, Axis axis, float coord void CurveView::drawDot(KDContext * ctx, KDRect rect, float x, float y, KDColor color, KDSize size) const { KDCoordinate px = roundf(floatToPixel(Axis::Horizontal, x)); KDCoordinate py = roundf(floatToPixel(Axis::Vertical, y)); - if ((px - size.width() < rect.left() - k_externRectMargin || px + size.width() > rect.right() + k_externRectMargin) && - (py - size.height() < rect.top() - k_externRectMargin || py + size.height() > rect.bottom() + k_externRectMargin)) { + if ((px + size.width() < rect.left() - k_externRectMargin || px - size.width() > rect.right() + k_externRectMargin) && + (py + size.height() < rect.top() - k_externRectMargin || py - size.height() > rect.bottom() + k_externRectMargin)) { return; } KDRect dotRect = KDRect(px - size.width()/2, py-size.height()/2, size.width(), size.height()); diff --git a/apps/regression/graph_view.cpp b/apps/regression/graph_view.cpp index 3c95177dd..d7fbfe8b2 100644 --- a/apps/regression/graph_view.cpp +++ b/apps/regression/graph_view.cpp @@ -14,7 +14,7 @@ GraphView::GraphView(Data * data) : void GraphView::reloadSelection() { float pixelXSelection = roundf(floatToPixel(Axis::Horizontal, m_data->xCursorPosition())); float pixelYSelection = roundf(floatToPixel(Axis::Vertical, m_data->yCursorPosition())); - KDRect dirtyZone(KDRect(pixelXSelection - k_dotSize, pixelYSelection - k_dotSize, 2*k_dotSize, 2*k_dotSize)); + KDRect dirtyZone(KDRect(pixelXSelection - k_cursorSize/2, pixelYSelection - k_cursorSize/2, k_cursorSize, k_cursorSize)); markRectAsDirty(dirtyZone); layoutSubviews(); m_bannerView.reload();