Skip to content

Commit 072343b

Browse files
committed
Merge branch 'master' into TrainCarOperationsBugfixes
2 parents db9cc58 + 934fd3a commit 072343b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsViewerWindow.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,14 @@ public class TrainCarOperationsViewerWindow : Window
8484
public int RowsCount;
8585
public int SpacerRowCount;
8686
public int SymbolsRowCount;
87+
public int CurrentNewWidth;
8788
public bool BrakeHoseCarCoupling;
8889

8990
const int SymbolWidth = 32;
9091
public static bool FontChanged;
9192
public static bool FontToBold;
93+
public int DisplaySizeY;
94+
public bool DisplayReSized = false;
9295
public int WindowHeightMin;
9396
public int WindowHeightMax;
9497
public int WindowWidthMin;
@@ -305,6 +308,7 @@ private void ModifyWindowSize()
305308
{
306309
if (SymbolsRowCount > 0)
307310
{
311+
DisplaySizeY = Owner.Viewer.DisplaySize.Y;
308312
var desiredHeight = FontToBold ? Owner.TextFontDefaultBold.Height * RowsCount
309313
: (Owner.TextFontDefault.Height * RowsCount) + SymbolWidth;
310314
var desiredWidth = (SymbolsRowCount * SymbolWidth) + (SpacerRowCount * (SymbolWidth / 2)) + (LocoRowCount * (SymbolWidth * 2));
@@ -319,10 +323,12 @@ private void ModifyWindowSize()
319323
SizeTo(newWidth, newHeight);
320324
var locationX = Location.X;
321325
var locationY = newTop;
322-
if (Owner.Viewer.TrainCarOperationsWindow.LayoutMoved)
326+
if (Owner.Viewer.TrainCarOperationsWindow.LayoutMoved || newWidth != CurrentNewWidth || DisplayReSized)
323327
{
324328
CkeckCollision(newWidth, newHeight, ref locationX, ref locationY);
325329
Owner.Viewer.TrainCarOperationsWindow.LayoutMoved = false;
330+
CurrentNewWidth = newWidth;
331+
DisplayReSized = false;
326332
}
327333
MoveTo(locationX, locationY);
328334
}
@@ -482,6 +488,12 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
482488
UpdateWindowSize();
483489
}
484490

491+
if (DisplaySizeY != Owner.Viewer.DisplaySize.Y)
492+
{
493+
DisplayReSized = true;
494+
UpdateWindowSize();
495+
}
496+
485497
TrainCar trainCar = Owner.Viewer.PlayerTrain.Cars[CarPosition];
486498
bool isElectricDieselLocomotive = (trainCar is MSTSElectricLocomotive) || (trainCar is MSTSDieselLocomotive);
487499

0 commit comments

Comments
 (0)