@@ -166,7 +166,6 @@ public void ToggleCabCameraView()
166
166
List < Camera > WellKnownCameras ; // Providing Camera save functionality by GeorgeS
167
167
168
168
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.
170
169
171
170
// This is the train we are controlling
172
171
public TrainCar PlayerLocomotive { get { return Simulator . PlayerLocomotive ; } set { Simulator . PlayerLocomotive = value ; } }
@@ -1437,15 +1436,10 @@ void HandleUserInput(ElapsedTime elapsedTime)
1437
1436
ForceMouseVisible = false ;
1438
1437
}
1439
1438
1440
- // reset cursor type when needed
1441
-
1442
- if ( ! ( Camera is CabCamera ) && ! ( Camera is ThreeDimCabCamera ) && ActualCursor != Cursors . Default ) ActualCursor = Cursors . Default ;
1443
-
1444
1439
if ( UserInput . IsMouseLeftButtonPressed || RenderProcess . IsMouseVisible )
1445
1440
{
1446
- var locoViewer = ( PlayerLocomotiveViewer as MSTSLocomotiveViewer ) ;
1441
+ var locoViewer = PlayerLocomotiveViewer as MSTSLocomotiveViewer ;
1447
1442
1448
- // Mouse control for 2D cab
1449
1443
if ( Camera is CabCamera && locoViewer . _hasCabRenderer )
1450
1444
{
1451
1445
foreach ( var controlRenderer in locoViewer . _CabRenderer . ControlMap . Values )
@@ -1463,8 +1457,7 @@ void HandleUserInput(ElapsedTime elapsedTime)
1463
1457
}
1464
1458
}
1465
1459
}
1466
- // mouse for 3D camera
1467
- if ( Camera is ThreeDimCabCamera && locoViewer . _has3DCabRenderer )
1460
+ else if ( Camera is ThreeDimCabCamera && locoViewer . _has3DCabRenderer )
1468
1461
{
1469
1462
var trainCarShape = locoViewer . ThreeDimentionCabViewer . TrainCarShape ;
1470
1463
float bestD = 0.01f ; // 10 cm squared click range
@@ -1497,35 +1490,33 @@ void HandleUserInput(ElapsedTime elapsedTime)
1497
1490
}
1498
1491
}
1499
1492
}
1493
+ else
1494
+ {
1495
+ ActualCursor = Cursors . Default ;
1496
+ }
1500
1497
}
1501
1498
1502
1499
if ( MousePickedControl != null & MousePickedControl != OldMousePickedControl )
1503
1500
Simulator . Confirmer . Message ( ConfirmLevel . None , String . IsNullOrEmpty ( MousePickedControl . ControlLabel ) ? MousePickedControl . GetControlName ( ) : MousePickedControl . ControlLabel ) ;
1504
1501
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 ( ) ;
1507
1506
1508
1507
OldMousePickedControl = MousePickedControl ;
1509
1508
MousePickedControl = null ;
1510
1509
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 ;
1519
1513
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 )
1524
1515
MouseVisibleTillRealTime = RealTime + 1 ;
1525
1516
1526
1517
RenderProcess . IsMouseVisible = ForceMouseVisible || RealTime < MouseVisibleTillRealTime ;
1527
- originalMouseState = currentMouseState ;
1528
- RenderProcess . ActualCursor = ActualCursor ;
1518
+
1519
+ UserInput . Handled ( ) ;
1529
1520
}
1530
1521
1531
1522
static bool IsReverserInNeutral ( TrainCar car )
0 commit comments