@@ -79,18 +79,21 @@ public VirtualizedScrollPane(
79
79
hbar .blockIncrementProperty ().bind (hbar .visibleAmountProperty ());
80
80
vbar .blockIncrementProperty ().bind (vbar .visibleAmountProperty ());
81
81
82
+ Val <Double > hContentPadding = Val .map (content .paddingProperty (), p -> p .getLeft () + p .getRight ());
83
+ Val <Double > vContentPadding = Val .map (content .paddingProperty (), p -> p .getTop () + p .getBottom ());
84
+
82
85
// scrollbar positions
83
86
hPosEstimate = Val .combine (
84
87
content .estimatedScrollXProperty (),
85
88
Val .map (content .layoutBoundsProperty (), Bounds ::getWidth ),
86
- Val . map ( content . paddingProperty (), p -> p . getLeft () + p . getRight ()) ,
89
+ hContentPadding ,
87
90
content .totalWidthEstimateProperty (),
88
91
VirtualizedScrollPane ::offsetToScrollbarPosition )
89
92
.asVar (this ::setHPosition );
90
93
vPosEstimate = Val .combine (
91
94
content .estimatedScrollYProperty (),
92
95
Val .map (content .layoutBoundsProperty (), Bounds ::getHeight ),
93
- Val . map ( content . paddingProperty (), p -> p . getTop () + p . getBottom ()) ,
96
+ vContentPadding ,
94
97
content .totalHeightEstimateProperty (),
95
98
VirtualizedScrollPane ::offsetToScrollbarPosition )
96
99
.orElseConst (0.0 )
@@ -128,28 +131,30 @@ public VirtualizedScrollPane(
128
131
Val <Double > layoutHeight = Val .map (layoutBoundsProperty (), Bounds ::getHeight );
129
132
Val <Boolean > needsHBar0 = Val .combine (
130
133
content .totalWidthEstimateProperty (),
131
- content . paddingProperty () ,
134
+ hContentPadding ,
132
135
layoutWidth ,
133
- (cw , cp , lw ) -> cw + cp . getLeft () + cp . getRight () > lw );
136
+ (cw , hcp , lw ) -> cw + hcp > lw );
134
137
Val <Boolean > needsVBar0 = Val .combine (
135
138
content .totalHeightEstimateProperty (),
136
- content . paddingProperty () ,
139
+ vContentPadding ,
137
140
layoutHeight ,
138
- (ch , cp , lh ) -> ch + cp . getTop () + cp . getBottom () > lh );
141
+ (ch , vcp , lh ) -> ch + vcp > lh );
139
142
Val <Boolean > needsHBar = Val .combine (
140
143
needsHBar0 ,
141
144
needsVBar0 ,
142
145
content .totalWidthEstimateProperty (),
146
+ hContentPadding ,
143
147
vbar .widthProperty (),
144
148
layoutWidth ,
145
- (needsH , needsV , cw , vbw , lw ) -> needsH || needsV && cw + vbw .doubleValue () > lw );
149
+ (needsH , needsV , cw , hcp , vbw , lw ) -> needsH || needsV && cw + hcp + vbw .doubleValue () > lw );
146
150
Val <Boolean > needsVBar = Val .combine (
147
151
needsVBar0 ,
148
152
needsHBar0 ,
149
153
content .totalHeightEstimateProperty (),
154
+ vContentPadding ,
150
155
hbar .heightProperty (),
151
156
layoutHeight ,
152
- (needsV , needsH , ch , hbh , lh ) -> needsV || needsH && ch + hbh .doubleValue () > lh );
157
+ (needsV , needsH , ch , vcp , hbh , lh ) -> needsV || needsH && ch + vcp + hbh .doubleValue () > lh );
153
158
154
159
Val <Boolean > shouldDisplayHorizontal = Val .flatMap (hbarPolicy , policy -> {
155
160
switch (policy ) {
0 commit comments