diff --git a/src/main/java/org/fxmisc/flowless/Navigator.java b/src/main/java/org/fxmisc/flowless/Navigator.java index 90eabf7..fa2dcdc 100644 --- a/src/main/java/org/fxmisc/flowless/Navigator.java +++ b/src/main/java/org/fxmisc/flowless/Navigator.java @@ -96,7 +96,10 @@ public void setTargetPosition(TargetPosition targetPosition) { * and re-lays out the viewport */ public void scrollCurrentPositionBy(double delta) { - targetPosition = currentPosition.scrollBy(delta); + // delta needs rounding otherwise thin lines appear between cells, + // notably when scrolling with a mouse or using a scroll bar and + // usually only visible when cells have dark backgrounds/borders. + targetPosition = currentPosition.scrollBy(Math.round(delta)); requestLayout(); } diff --git a/src/main/java/org/fxmisc/flowless/VirtualizedScrollPane.java b/src/main/java/org/fxmisc/flowless/VirtualizedScrollPane.java index d09021e..38bc1ab 100644 --- a/src/main/java/org/fxmisc/flowless/VirtualizedScrollPane.java +++ b/src/main/java/org/fxmisc/flowless/VirtualizedScrollPane.java @@ -324,7 +324,7 @@ private void setHPosition(double pos) { pos, content.getLayoutBounds().getWidth(), content.totalWidthEstimateProperty().getValue()); - content.estimatedScrollXProperty().setValue(offset); + content.estimatedScrollXProperty().setValue((double) Math.round(offset)); } private void setVPosition(double pos) { @@ -332,7 +332,9 @@ private void setVPosition(double pos) { pos, content.getLayoutBounds().getHeight(), content.totalHeightEstimateProperty().getValue()); - content.estimatedScrollYProperty().setValue(offset); + // offset needs rounding otherwise thin lines appear between cells, + // usually only visible when cells have dark backgrounds/borders. + content.estimatedScrollYProperty().setValue((double) Math.round(offset)); } private static void setupUnitIncrement(ScrollBar bar) {