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
This commit is contained in:
Ingo Weinhold
2009-05-08 01:22:58 +00:00
parent aaeffcf7a6
commit 89c7f409e9
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -65,6 +65,7 @@ Chart::Chart(ChartRenderer* renderer, const char* name)
fVScrollSize(0), fVScrollSize(0),
fHScrollValue(0), fHScrollValue(0),
fVScrollValue(0), fVScrollValue(0),
fIgnoreScrollEvent(0),
fDomainZoomLimit(0), fDomainZoomLimit(0),
fLastMousePos(-1, -1), fLastMousePos(-1, -1),
fDraggingStartPos(-1, -1) fDraggingStartPos(-1, -1)
@@ -407,6 +408,9 @@ printf("Chart::Draw((%f, %f) - (%f, %f))\n", updateRect.left, updateRect.top, up
void void
Chart::ScrollTo(BPoint where) Chart::ScrollTo(BPoint where)
{ {
if (fIgnoreScrollEvent > 0)
return;
_ScrollTo(where.x, true); _ScrollTo(where.x, true);
_ScrollTo(where.y, false); _ScrollTo(where.y, false);
} }
@@ -531,8 +535,9 @@ Chart::_UpdateScrollBar(bool horizontal)
} }
if (scrollBar != NULL) { if (scrollBar != NULL) {
fIgnoreScrollEvent++;
scrollBar->SetRange(0, scrollSize); scrollBar->SetRange(0, scrollSize);
// TODO: If the scroll range changes, we might need to reset the scroll value. fIgnoreScrollEvent--;
scrollBar->SetValue(scrollValue); scrollBar->SetValue(scrollValue);
scrollBar->SetProportion(proportion); scrollBar->SetProportion(proportion);
} }
+1
View File
@@ -107,6 +107,7 @@ private:
float fVScrollSize; float fVScrollSize;
float fHScrollValue; float fHScrollValue;
float fVScrollValue; float fVScrollValue;
int32 fIgnoreScrollEvent;
double fDomainZoomLimit; double fDomainZoomLimit;
BPoint fLastMousePos; BPoint fLastMousePos;
BPoint fDraggingStartPos; BPoint fDraggingStartPos;