@@ -22,11 +22,6 @@ use crate::theme;
22
22
use crate :: widget:: { Axis , Viewport } ;
23
23
use crate :: { Env , Event , EventCtx , LifeCycle , LifeCycleCtx , PaintCtx , RenderContext , TimerToken } ;
24
24
25
- //TODO: Add this to env
26
- /// Minimum length for any scrollbar to be when measured on that
27
- /// scrollbar's primary axis.
28
- pub const SCROLLBAR_MIN_SIZE : f64 = 45.0 ;
29
-
30
25
#[ derive( Debug , Copy , Clone ) ]
31
26
/// Which scroll bars of a scroll area are currently enabled.
32
27
pub enum ScrollbarsEnabled {
@@ -187,12 +182,13 @@ impl ScrollComponent {
187
182
188
183
let bar_width = env. get ( theme:: SCROLLBAR_WIDTH ) ;
189
184
let bar_pad = env. get ( theme:: SCROLLBAR_PAD ) ;
185
+ let bar_min_size = env. get ( theme:: SCROLLBAR_MIN_SIZE ) ;
190
186
191
187
let percent_visible = viewport_size. height / content_size. height ;
192
188
let percent_scrolled = scroll_offset. y / ( content_size. height - viewport_size. height ) ;
193
189
194
190
let length = ( percent_visible * viewport_size. height ) . ceil ( ) ;
195
- let length = length. max ( SCROLLBAR_MIN_SIZE ) ;
191
+ let length = length. max ( bar_min_size ) ;
196
192
197
193
let vertical_padding = bar_pad + bar_pad + bar_width;
198
194
@@ -222,12 +218,13 @@ impl ScrollComponent {
222
218
223
219
let bar_width = env. get ( theme:: SCROLLBAR_WIDTH ) ;
224
220
let bar_pad = env. get ( theme:: SCROLLBAR_PAD ) ;
221
+ let bar_min_size = env. get ( theme:: SCROLLBAR_MIN_SIZE ) ;
225
222
226
223
let percent_visible = viewport_size. width / content_size. width ;
227
224
let percent_scrolled = scroll_offset. x / ( content_size. width - viewport_size. width ) ;
228
225
229
226
let length = ( percent_visible * viewport_size. width ) . ceil ( ) ;
230
- let length = length. max ( SCROLLBAR_MIN_SIZE ) ;
227
+ let length = length. max ( bar_min_size ) ;
231
228
232
229
let horizontal_padding = bar_pad + bar_pad + bar_width;
233
230
0 commit comments