[apps/regression] Fix bug: in the graph page, correctly redraw the dots when needed

Change-Id: I23c729003bccaaa91b593b636eee8a49ac6c6ffc
This commit is contained in:
Émilie Feral
2017-01-02 14:22:32 +01:00
parent 33133648b7
commit e6e526c2cb
2 changed files with 3 additions and 3 deletions

View File

@@ -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());

View File

@@ -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();