@@ -96,6 +96,8 @@ public class TrainCarOperationsWindow : Window
9696 public bool IsFullScreen = false ;
9797 public int RowHeight ;
9898 public int OldPositionHeight ;
99+ public bool UpdateTrainCarOperation = false ;
100+ public List < int > LabelPositionTop = new List < int > ( ) ;
99101
100102 //Rectangle carLabelPosition;
101103 public string CarLabelText ;
@@ -345,6 +347,16 @@ void AddSpace()
345347 RearBrakes = Enumerable . Repeat ( true , PlayerTrain . Cars . Count ) . ToList ( ) ;
346348 }
347349
350+ if ( LabelPositionTop . Count == 0 )
351+ {
352+ var n = scrollbox . Position . Y ; // first row
353+ for ( var i = 0 ; i < PlayerTrain . Cars . Count ; i ++ )
354+ { // Position of each row
355+ LabelPositionTop . Add ( n ) ;
356+ n += ( textHeight + ControlLayout . SeparatorSize ) ;
357+ }
358+ }
359+
348360 // reset WarningCarPosition
349361 WarningCarPosition = Enumerable . Repeat ( false , PlayerTrain . Cars . Count ) . ToList ( ) ;
350362
@@ -603,6 +615,15 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
603615 carOperations . CarOperationChanged = carOperations . Visible && carOperations . CarOperationChanged ;
604616 }
605617
618+ if ( CarPosition != trainCarViewer . CarPosition )
619+ {
620+ // Required to scroll the main window from the web version
621+ UpdateTrainCarOperation = true ;
622+ CarPosition = trainCarViewer . CarPosition ;
623+ LabelTop = LabelPositionTop [ SelectedCarPosition ] ;
624+ Layout ( ) ;
625+ localScrollLayout ( SelectedCarPosition ) ;
626+ }
606627 //Resize this window after the font has been changed externally
607628 else if ( MultiPlayerWindow . FontChanged )
608629 {
0 commit comments