From 89c7f409e99b39be737052c21607219794cd7d05 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 8 May 2009 01:22:58 +0000 Subject: [PATCH] Squashed TODO in Chart::_UpdateScrollBar(): We set both scroll bar range and value -- make sure to ignore feedback when setting the range (happens when the old value doesn't fit the range anymore). Fixes unexpected jumps when zooming out. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30666 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debuganalyzer/gui/chart/Chart.cpp | 7 ++++++- src/apps/debuganalyzer/gui/chart/Chart.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/apps/debuganalyzer/gui/chart/Chart.cpp b/src/apps/debuganalyzer/gui/chart/Chart.cpp index 1a66539232..a100965785 100644 --- a/src/apps/debuganalyzer/gui/chart/Chart.cpp +++ b/src/apps/debuganalyzer/gui/chart/Chart.cpp @@ -65,6 +65,7 @@ Chart::Chart(ChartRenderer* renderer, const char* name) fVScrollSize(0), fHScrollValue(0), fVScrollValue(0), + fIgnoreScrollEvent(0), fDomainZoomLimit(0), fLastMousePos(-1, -1), fDraggingStartPos(-1, -1) @@ -407,6 +408,9 @@ printf("Chart::Draw((%f, %f) - (%f, %f))\n", updateRect.left, updateRect.top, up void Chart::ScrollTo(BPoint where) { + if (fIgnoreScrollEvent > 0) + return; + _ScrollTo(where.x, true); _ScrollTo(where.y, false); } @@ -531,8 +535,9 @@ Chart::_UpdateScrollBar(bool horizontal) } if (scrollBar != NULL) { + fIgnoreScrollEvent++; scrollBar->SetRange(0, scrollSize); -// TODO: If the scroll range changes, we might need to reset the scroll value. + fIgnoreScrollEvent--; scrollBar->SetValue(scrollValue); scrollBar->SetProportion(proportion); } diff --git a/src/apps/debuganalyzer/gui/chart/Chart.h b/src/apps/debuganalyzer/gui/chart/Chart.h index d4d10665c2..b2cc114dda 100644 --- a/src/apps/debuganalyzer/gui/chart/Chart.h +++ b/src/apps/debuganalyzer/gui/chart/Chart.h @@ -107,6 +107,7 @@ private: float fVScrollSize; float fHScrollValue; float fVScrollValue; + int32 fIgnoreScrollEvent; double fDomainZoomLimit; BPoint fLastMousePos; BPoint fDraggingStartPos;