@@ -38,12 +38,7 @@ protected ScrollBar(bool focusable = true)
3838 HorizontalAlignment = HorizontalAlignment . Stretch ;
3939 }
4040
41- this . Minimum ( 0 ) ;
42- this . Maximum ( 0 ) ;
43- this . ScrollValue ( 0 ) ;
44- this . ViewportSize ( 0 ) ;
45- this . SmallChange ( 1 ) ;
46- this . LargeChange ( 0 ) ;
41+ this . SmallChange = 1 ;
4742 }
4843
4944 /// <summary>
@@ -67,7 +62,7 @@ protected ScrollBar(bool focusable = true)
6762 /// Gets or sets the current value.
6863 /// </summary>
6964 [ Bindable ]
70- public partial int ScrollValue { get ; set ; }
65+ public partial int Value { get ; set ; }
7166
7267 /// <summary>
7368 /// Gets or sets the viewport size, used to compute the thumb length.
@@ -93,13 +88,13 @@ protected ScrollBar(bool focusable = true)
9388
9489 partial void OnLargeChangeChanging ( ref int value ) => ArgumentOutOfRangeException . ThrowIfNegative ( value ) ;
9590
96- partial void OnScrollValueChanging ( ref int value )
91+ partial void OnValueChanging ( ref int value )
9792 {
98- _oldValueForEvent = _scrollValue ;
93+ _oldValueForEvent = _value ;
9994 value = Clamp ( value ) ;
10095 }
10196
102- partial void OnScrollValueChanged ( int value )
97+ partial void OnValueChanged ( int value )
10398 {
10499 if ( _oldValueForEvent != value )
105100 {
@@ -248,7 +243,7 @@ private void RenderHorizontal(CellBuffer buffer, Rectangle rect, ScrollBarGlyphs
248243 thumbLength = Math . Clamp ( thumbLength , minThumb , trackLength ) ;
249244
250245 var trackAvail = Math . Max ( 1 , trackLength - thumbLength ) ;
251- var offset = Math . Clamp ( ScrollValue - min , 0 , range ) ;
246+ var offset = Math . Clamp ( Value - min , 0 , range ) ;
252247 var thumbStart = ( int ) Math . Round ( ( double ) offset * trackAvail / range ) ;
253248 thumbStart = Math . Clamp ( thumbStart , 0 , trackLength - thumbLength ) ;
254249
@@ -278,7 +273,7 @@ protected override void OnPointerPressed(PointerEventArgs e)
278273 _dragging = true ;
279274 _dragStartUiX = e . UiX ;
280275 _dragStartUiY = e . UiY ;
281- _dragStartValue = ScrollValue ;
276+ _dragStartValue = Value ;
282277 e . Handled = true ;
283278 return ;
284279 }
@@ -290,7 +285,7 @@ protected override void OnPointerPressed(PointerEventArgs e)
290285 page = Math . Max ( 1 , ViewportSize ) ;
291286 }
292287
293- ScrollValue = local < thumbStart ? ScrollValue - page : ScrollValue + page ;
288+ Value = local < thumbStart ? Value - page : Value + page ;
294289 e . Handled = true ;
295290 }
296291
@@ -327,7 +322,7 @@ protected override void OnPointerMoved(PointerEventArgs e)
327322
328323 var delta = Orientation == Orientation . Vertical ? ( e . UiY - _dragStartUiY ) : ( e . UiX - _dragStartUiX ) ;
329324 var deltaValue = ( int ) Math . Round ( ( double ) delta * range / trackAvail ) ;
330- ScrollValue = Math . Clamp ( _dragStartValue + deltaValue , min , max ) ;
325+ Value = Math . Clamp ( _dragStartValue + deltaValue , min , max ) ;
331326 e . Handled = true ;
332327 }
333328
@@ -355,7 +350,7 @@ protected override void OnPointerWheel(PointerEventArgs e)
355350 }
356351
357352 var step = Math . Max ( 1 , SmallChange ) ;
358- ScrollValue = e . WheelDelta > 0 ? ScrollValue - step : ScrollValue + step ;
353+ Value = e . WheelDelta > 0 ? Value - step : Value + step ;
359354 e . Handled = true ;
360355 }
361356
@@ -370,27 +365,27 @@ protected override void OnKeyDown(KeyEventArgs e)
370365 switch ( e . Key )
371366 {
372367 case TerminalKey . Up :
373- ScrollValue -= step ;
368+ Value -= step ;
374369 e . Handled = true ;
375370 return ;
376371 case TerminalKey . Down :
377- ScrollValue += step ;
372+ Value += step ;
378373 e . Handled = true ;
379374 return ;
380375 case TerminalKey . PageUp :
381- ScrollValue -= page ;
376+ Value -= page ;
382377 e . Handled = true ;
383378 return ;
384379 case TerminalKey . PageDown :
385- ScrollValue += page ;
380+ Value += page ;
386381 e . Handled = true ;
387382 return ;
388383 case TerminalKey . Home :
389- ScrollValue = Minimum ;
384+ Value = Minimum ;
390385 e . Handled = true ;
391386 return ;
392387 case TerminalKey . End :
393- ScrollValue = Maximum ;
388+ Value = Maximum ;
394389 e . Handled = true ;
395390 return ;
396391 }
@@ -400,27 +395,27 @@ protected override void OnKeyDown(KeyEventArgs e)
400395 switch ( e . Key )
401396 {
402397 case TerminalKey . Left :
403- ScrollValue -= step ;
398+ Value -= step ;
404399 e . Handled = true ;
405400 return ;
406401 case TerminalKey . Right :
407- ScrollValue += step ;
402+ Value += step ;
408403 e . Handled = true ;
409404 return ;
410405 case TerminalKey . PageUp :
411- ScrollValue -= page ;
406+ Value -= page ;
412407 e . Handled = true ;
413408 return ;
414409 case TerminalKey . PageDown :
415- ScrollValue += page ;
410+ Value += page ;
416411 e . Handled = true ;
417412 return ;
418413 case TerminalKey . Home :
419- ScrollValue = Minimum ;
414+ Value = Minimum ;
420415 e . Handled = true ;
421416 return ;
422417 case TerminalKey . End :
423- ScrollValue = Maximum ;
418+ Value = Maximum ;
424419 e . Handled = true ;
425420 return ;
426421 }
0 commit comments