Skip to content

Commit 00837f3

Browse files
committed
Reset right-click scrolling position when MapUI isn't the active control
1 parent b162e6f commit 00837f3

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/TSMapEditor/UI/MapUI.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,16 +548,26 @@ public override void OnRightClick(InputEventArgs inputEventArgs)
548548
{
549549
inputEventArgs.Handled = true;
550550

551-
if (CursorAction != null && !isRightClickScrolling)
551+
if (isRightClickScrolling)
552+
{
553+
StopRightClickScrolling();
554+
}
555+
else if (CursorAction != null)
552556
{
553557
CursorAction = null;
554558
}
555559

556-
isRightClickScrolling = false;
560+
StopRightClickScrolling();
557561

558562
base.OnRightClick(inputEventArgs);
559563
}
560564

565+
private void StopRightClickScrolling()
566+
{
567+
isRightClickScrolling = false;
568+
rightClickScrollInitPos = new Point(-1, -1);
569+
}
570+
561571
private MapTile CalculateBestTileUnderCursor()
562572
{
563573
Point2D cursorMapPoint = GetCursorMapPoint();
@@ -613,6 +623,10 @@ public override void Update(GameTime gameTime)
613623
}
614624
}
615625
}
626+
else if (isRightClickScrolling)
627+
{
628+
StopRightClickScrolling();
629+
}
616630

617631
if (leftPressedDownOnControl && !Cursor.LeftDown)
618632
leftPressedDownOnControl = false;

0 commit comments

Comments
 (0)