diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-01-03 18:44:09 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-02-07 22:39:54 -0500 |
commit | 11c080962b3eb927f61d982f910725b255b1ec77 (patch) | |
tree | a4a2b327aecfe40098dad61181faa368c663cfd9 | |
parent | e627a8a5e5a93df15a4a7c502231254e7c26c976 (diff) | |
download | SMAPI-11c080962b3eb927f61d982f910725b255b1ec77.tar.gz SMAPI-11c080962b3eb927f61d982f910725b255b1ec77.tar.bz2 SMAPI-11c080962b3eb927f61d982f910725b255b1ec77.zip |
fix cursor position not updated in edge case
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI/Framework/Input/SInputState.cs | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 84e322fe..9a6be891 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -14,6 +14,7 @@ * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. + * Fixed `e.Cursor` in input events showing wrong grab tile when player using a controller moves without moving the viewpoint. ## 2.10.1 Released 30 December 2018 for Stardew Valley 1.3.32. 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 /// <summary>The cursor position on the screen adjusted for the zoom level.</summary> private CursorPosition CursorPositionImpl; + /// <summary>The player's last known tile position.</summary> + 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 |