File tree Expand file tree Collapse file tree 1 file changed +6
-22
lines changed
Expand file tree Collapse file tree 1 file changed +6
-22
lines changed Original file line number Diff line number Diff line change 66using SkiaSharp . Views . Desktop ;
77using System ;
88using System . IO ;
9+ using System . Linq ;
910using System . Reflection ;
1011using System . Windows . Forms ;
1112
@@ -154,16 +155,11 @@ protected override void OnMouseClick(MouseEventArgs e)
154155 }
155156
156157 // Check if carousel indicator was clicked
157- if ( renderer . CarouselIndicatorRects != null )
158+ var clickedIndex = Array . FindIndex ( renderer . CarouselIndicatorRects ?? [ ] , r => r . Contains ( e . Location ) ) ;
159+ if ( clickedIndex != - 1 )
158160 {
159- for ( int i = 0 ; i < renderer . CarouselIndicatorRects . Length ; i ++ )
160- {
161- if ( renderer . CarouselIndicatorRects [ i ] . Contains ( e . Location ) )
162- {
163- ViewModel . SelectedIndex = i ;
164- return ;
165- }
166- }
161+ ViewModel . SelectedIndex = clickedIndex ;
162+ return ;
167163 }
168164 }
169165
@@ -199,19 +195,7 @@ protected override void OnMouseMove(MouseEventArgs e)
199195 }
200196
201197 // Check carousel indicators for hand cursor
202- bool isOverCarouselIndicator = false ;
203- if ( renderer . CarouselIndicatorRects != null )
204- {
205- foreach ( var rect in renderer . CarouselIndicatorRects )
206- {
207- if ( rect . Contains ( e . Location ) )
208- {
209- isOverCarouselIndicator = true ;
210- break ;
211- }
212- }
213- }
214-
198+ bool isOverCarouselIndicator = renderer . CarouselIndicatorRects ? . Any ( r => r . Contains ( e . Location ) ) ?? false ;
215199 bool isOverClickable = hoveredItem != HoveredItem . None || isOverCarouselIndicator ;
216200 Cursor = isOverClickable ? Cursors . Hand : Cursors . Default ;
217201
You can’t perform that action at this time.
0 commit comments