@@ -166,7 +166,6 @@ public void ToggleCabCameraView()
166166 List < Camera > WellKnownCameras ; // Providing Camera save functionality by GeorgeS
167167
168168 public TrainCarViewer PlayerLocomotiveViewer { get ; private set ; } // we are controlling this loco, or null if we aren't controlling any
169- MouseState originalMouseState ; // Current mouse coordinates.
170169
171170 // This is the train we are controlling
172171 public TrainCar PlayerLocomotive { get { return Simulator . PlayerLocomotive ; } set { Simulator . PlayerLocomotive = value ; } }
@@ -1437,15 +1436,10 @@ void HandleUserInput(ElapsedTime elapsedTime)
14371436 ForceMouseVisible = false ;
14381437 }
14391438
1440- // reset cursor type when needed
1441-
1442- if ( ! ( Camera is CabCamera ) && ! ( Camera is ThreeDimCabCamera ) && ActualCursor != Cursors . Default ) ActualCursor = Cursors . Default ;
1443-
14441439 if ( UserInput . IsMouseLeftButtonPressed || RenderProcess . IsMouseVisible )
14451440 {
1446- var locoViewer = ( PlayerLocomotiveViewer as MSTSLocomotiveViewer ) ;
1441+ var locoViewer = PlayerLocomotiveViewer as MSTSLocomotiveViewer ;
14471442
1448- // Mouse control for 2D cab
14491443 if ( Camera is CabCamera && locoViewer . _hasCabRenderer )
14501444 {
14511445 foreach ( var controlRenderer in locoViewer . _CabRenderer . ControlMap . Values )
@@ -1463,8 +1457,7 @@ void HandleUserInput(ElapsedTime elapsedTime)
14631457 }
14641458 }
14651459 }
1466- // mouse for 3D camera
1467- if ( Camera is ThreeDimCabCamera && locoViewer . _has3DCabRenderer )
1460+ else if ( Camera is ThreeDimCabCamera && locoViewer . _has3DCabRenderer )
14681461 {
14691462 var trainCarShape = locoViewer . ThreeDimentionCabViewer . TrainCarShape ;
14701463 float bestD = 0.01f ; // 10 cm squared click range
@@ -1497,35 +1490,33 @@ void HandleUserInput(ElapsedTime elapsedTime)
14971490 }
14981491 }
14991492 }
1493+ else
1494+ {
1495+ ActualCursor = Cursors . Default ;
1496+ }
15001497 }
15011498
15021499 if ( MousePickedControl != null & MousePickedControl != OldMousePickedControl )
15031500 Simulator . Confirmer . Message ( ConfirmLevel . None , String . IsNullOrEmpty ( MousePickedControl . ControlLabel ) ? MousePickedControl . GetControlName ( ) : MousePickedControl . ControlLabel ) ;
15041501
1505- if ( MousePickedControl != null ) ActualCursor = Cursors . Hand ;
1506- else if ( ActualCursor == Cursors . Hand ) ActualCursor = Cursors . Default ;
1502+ ActualCursor = RenderProcess . ActualCursor = MousePickedControl != null ? Cursors . Hand : Cursors . Default ;
1503+
1504+ if ( UserInput . IsMouseWheelChanged )
1505+ MousePickedControl ? . HandleUserInput ( ) ;
15071506
15081507 OldMousePickedControl = MousePickedControl ;
15091508 MousePickedControl = null ;
15101509
1511- if ( MouseChangingControl != null )
1512- {
1513- MouseChangingControl . HandleUserInput ( ) ;
1514- if ( UserInput . IsMouseLeftButtonReleased )
1515- MouseChangingControl = null ;
1516- }
1517-
1518- UserInput . Handled ( ) ;
1510+ MouseChangingControl ? . HandleUserInput ( ) ;
1511+ if ( UserInput . IsMouseLeftButtonReleased )
1512+ MouseChangingControl = null ;
15191513
1520- MouseState currentMouseState = Mouse . GetState ( ) ;
1521-
1522- if ( currentMouseState . X != originalMouseState . X ||
1523- currentMouseState . Y != originalMouseState . Y )
1514+ if ( UserInput . IsMouseMoved || RenderProcess . IsMouseVisible && UserInput . IsMouseWheelChanged )
15241515 MouseVisibleTillRealTime = RealTime + 1 ;
15251516
15261517 RenderProcess . IsMouseVisible = ForceMouseVisible || RealTime < MouseVisibleTillRealTime ;
1527- originalMouseState = currentMouseState ;
1528- RenderProcess . ActualCursor = ActualCursor ;
1518+
1519+ UserInput . Handled ( ) ;
15291520 }
15301521
15311522 static bool IsReverserInNeutral ( TrainCar car )
0 commit comments