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:
parent
aaeffcf7a6
commit
89c7f409e9
@ -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);
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ private:
|
||||
float fVScrollSize;
|
||||
float fHScrollValue;
|
||||
float fVScrollValue;
|
||||
int32 fIgnoreScrollEvent;
|
||||
double fDomainZoomLimit;
|
||||
BPoint fLastMousePos;
|
||||
BPoint fDraggingStartPos;
|
||||
|
Loading…
Reference in New Issue
Block a user