- horizontalScrollBar()->setRange(0,
- max((int)(length - areaSize.width()), 0));
- horizontalScrollBar()->setSliderPosition(offset);
+
+ if(length < MaxScrollValue) {
+ horizontalScrollBar()->setRange(0, length);
+ horizontalScrollBar()->setSliderPosition(offset);
+ } else {
+ horizontalScrollBar()->setRange(0, MaxScrollValue);
+ horizontalScrollBar()->setSliderPosition(
+ _offset * MaxScrollValue / (_scale * length));
+ }