@@ -60,10 +60,10 @@ public partial class MudWheel<T> : MudBaseInput<T>
6060 public int WheelLevel { get ; set ; } = 2 ;
6161
6262 /// <summary>
63- /// The minimum swipe delta to change wheel value on touch devices. Default is 30 .
63+ /// The minimum swipe delta to change wheel value on touch devices. Default is 40 .
6464 /// </summary>
6565 [ Parameter ]
66- public int Sensitivity { get ; set ; } = 30 ;
66+ public int Sensitivity { get ; set ; } = 40 ;
6767
6868 [ Parameter ]
6969 public string InnerClass { get ; set ; }
@@ -143,18 +143,18 @@ protected async Task HandleOnWheel(WheelEventArgs args)
143143 await Task . Delay ( 300 ) ;
144144 }
145145
146- protected async Task HandleOnSwipe ( SwipeDirection direction )
146+ protected async Task HandleOnSwipe ( SwipeEventArgs args )
147147 {
148148 if ( Disabled || ReadOnly )
149149 {
150150 return ;
151151 }
152152 int index = GetIndex ( ) ;
153- if ( ( direction == SwipeDirection . TopToBottom && index == 0 ) || ( direction == SwipeDirection . BottomToTop && index == ItemCollection . Count - 1 ) )
153+ if ( ( args . SwipeDirection == SwipeDirection . TopToBottom && index == 0 ) || ( args . SwipeDirection == SwipeDirection . BottomToTop && index == ItemCollection . Count - 1 ) )
154154 {
155155 return ;
156156 }
157- if ( direction == SwipeDirection . BottomToTop )
157+ if ( args . SwipeDirection == SwipeDirection . BottomToTop )
158158 {
159159 _animateValue = GetAnimateValue ( ) ;
160160 }
@@ -163,19 +163,34 @@ protected async Task HandleOnSwipe(SwipeDirection direction)
163163 _animateValue = - GetAnimateValue ( ) ;
164164 }
165165
166-
167- await _animate . Refresh ( ) ;
168- if ( direction == SwipeDirection . TopToBottom )
169- {
170- T val = ItemCollection [ index - 1 ] ;
171- await SetValueAsync ( val ) ;
172- }
173- else if ( direction == SwipeDirection . BottomToTop )
166+ int changedCount = ( Math . Abs ( ( int ) args . SwipeDelta ) / ( Sensitivity == 0 ? 1 : Sensitivity ) ) ;
167+ for ( int i = 0 ; i < changedCount ; i ++ )
174168 {
175- T val = ItemCollection [ index + 1 ] ;
176- await SetValueAsync ( val ) ;
169+ await _animate . Refresh ( ) ;
170+ StateHasChanged ( ) ;
171+ if ( args . SwipeDirection == SwipeDirection . TopToBottom )
172+ {
173+ if ( index - 1 < 0 )
174+ {
175+ break ;
176+ }
177+ T val = ItemCollection [ index - 1 ] ;
178+ index -- ;
179+ await SetValueAsync ( val ) ;
180+ StateHasChanged ( ) ;
181+ }
182+ else if ( args . SwipeDirection == SwipeDirection . BottomToTop )
183+ {
184+ if ( ItemCollection . Count <= index + 1 )
185+ {
186+ break ;
187+ }
188+ T val = ItemCollection [ index + 1 ] ;
189+ index ++ ;
190+ await SetValueAsync ( val ) ;
191+ StateHasChanged ( ) ;
192+ }
177193 }
178-
179194 }
180195
181196 public async Task ChangeWheel ( int changeCount )
0 commit comments