Skip to content

Commit

Permalink
[NONE] Prevent flickering of scrollbars during zoom.
Browse files Browse the repository at this point in the history
- During zoom it may happen that the contents bounds min and max values do only imprecisely match those of the viewport bounds. While optically the content is fully contained in the viewport, mathematically it isn't. Thus scroll bars are made visible. During zoom that can lead to unintended visibility changes of the scroll bars, which looks like flickering. We can prevent it by using impresicion to detect whether scroll bars should be visible or not (while the underliyng values may still be computed precisely).
  • Loading branch information
nyssen committed Nov 16, 2016
1 parent 096ffe3 commit 7d35353
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1577,8 +1577,8 @@ protected void updateScrollBars() {

// show/hide horizontal scrollbar
ScrollBarPolicy hbarPolicy = horizontalScrollBarPolicyProperty.get();
boolean hbarIsNeeded = contentBounds[0] < 0
|| contentBounds[2] > getWidth();
boolean hbarIsNeeded = contentBounds[0] < -0.01
|| contentBounds[2] > getWidth() + 0.01;
if (hbarPolicy.equals(ScrollBarPolicy.ALWAYS)
|| hbarPolicy.equals(ScrollBarPolicy.AS_NEEDED)
&& hbarIsNeeded) {
Expand All @@ -1589,8 +1589,8 @@ protected void updateScrollBars() {

// show/hide vertical scrollbar
ScrollBarPolicy vbarPolicy = verticalScrollBarPolicyProperty.get();
boolean vbarIsNeeded = contentBounds[1] < 0
|| contentBounds[3] > getHeight();
boolean vbarIsNeeded = contentBounds[1] < -0.01
|| contentBounds[3] > getHeight() + 0.01;
if (vbarPolicy.equals(ScrollBarPolicy.ALWAYS)
|| vbarPolicy.equals(ScrollBarPolicy.AS_NEEDED)
&& vbarIsNeeded) {
Expand Down

0 comments on commit 7d35353

Please sign in to comment.