From 11c080962b3eb927f61d982f910725b255b1ec77 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 3 Jan 2019 18:44:09 -0500 Subject: fix cursor position not updated in edge case --- src/SMAPI/Framework/Input/SInputState.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/SMAPI/Framework/Input') diff --git a/src/SMAPI/Framework/Input/SInputState.cs b/src/SMAPI/Framework/Input/SInputState.cs index 0228db0d..96a7003a 100644 --- a/src/SMAPI/Framework/Input/SInputState.cs +++ b/src/SMAPI/Framework/Input/SInputState.cs @@ -20,6 +20,9 @@ namespace StardewModdingAPI.Framework.Input /// The cursor position on the screen adjusted for the zoom level. private CursorPosition CursorPositionImpl; + /// The player's last known tile position. + private Vector2? LastPlayerTile; + /********* ** Accessors @@ -83,13 +86,14 @@ namespace StardewModdingAPI.Framework.Input MouseState realMouse = Mouse.GetState(); var activeButtons = this.DeriveStatuses(this.ActiveButtons, realKeyboard, realMouse, realController); Vector2 cursorAbsolutePos = new Vector2(realMouse.X + Game1.viewport.X, realMouse.Y + Game1.viewport.Y); + Vector2? playerTilePos = Context.IsPlayerFree ? Game1.player.getTileLocation() : (Vector2?)null; // update real states this.ActiveButtons = activeButtons; this.RealController = realController; this.RealKeyboard = realKeyboard; this.RealMouse = realMouse; - if (this.CursorPositionImpl?.AbsolutePixels != cursorAbsolutePos) + if (cursorAbsolutePos != this.CursorPositionImpl?.AbsolutePixels || playerTilePos != this.LastPlayerTile) this.CursorPositionImpl = this.GetCursorPosition(realMouse, cursorAbsolutePos); // update suppressed states -- cgit