Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix #40 by setting lower offset value based on viewport size increase #42

Merged
merged 1 commit into from
Oct 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/main/java/org/fxmisc/flowless/VirtualFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,19 @@ protected void layoutChildren() {
}
}

orientation.relocate(navigator, -breadthOffset0.getValue(), 0);
double viewBreadth = orientation.breadth(this);
double navigatorBreadth = orientation.breadth(navigator);
double totalBreadth = breadthOffset0.getValue();
double breadthDifference = navigatorBreadth - totalBreadth;
if (breadthDifference < viewBreadth) {
// viewport is scrolled all the way to the end of its breadth.
// but now viewport size (breadth) has increased
double adjustment = viewBreadth - breadthDifference;
orientation.relocate(navigator, -(totalBreadth - adjustment), 0);
breadthOffset0.setValue(totalBreadth - adjustment);
} else {
orientation.relocate(navigator, -breadthOffset0.getValue(), 0);
}
}

@Override
Expand Down