From 677643c0c31d8510bb8b176b7d09280a5f201bf9 Mon Sep 17 00:00:00 2001 From: Jurgen Date: Mon, 21 Feb 2022 14:40:32 +0200 Subject: [PATCH 1/2] Fix thin lines between cells --- src/main/java/org/fxmisc/flowless/Navigator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); } From e0244c7ed47bb7e1833e832a171d6b76eec4f198 Mon Sep 17 00:00:00 2001 From: Jurgen Date: Mon, 21 Feb 2022 18:30:54 +0200 Subject: [PATCH 2/2] Fix thin lines between cells 2 --- .../java/org/fxmisc/flowless/VirtualizedScrollPane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) {