From e191d4919b9d7566e035b65c4c8a2a38f7776812 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 4 Dec 2023 10:20:29 +0100 Subject: [PATCH] Fixed InputHandler touch states being initialized incorrectly when touch handling is disabled Closes #10 --- CHANGELOG.md | 1 + MLEM/Input/InputHandler.cs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9c170f..f772185 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Improvements Fixes - Fixed TextInput not working correctly when using surrogate pairs +- Fixed InputHandler touch states being initialized incorrectly when touch handling is disabled ### MLEM.Ui Additions diff --git a/MLEM/Input/InputHandler.cs b/MLEM/Input/InputHandler.cs index 5729513..c17ce25 100644 --- a/MLEM/Input/InputHandler.cs +++ b/MLEM/Input/InputHandler.cs @@ -121,11 +121,11 @@ namespace MLEM.Input { /// /// Contains the , but with the taken into account. /// - public IList LastViewportTouchState { get; private set; } + public IList LastViewportTouchState { get; private set; } = new List(); /// /// Contains the , but with the taken into account. /// - public IList ViewportTouchState { get; private set; } + public IList ViewportTouchState { get; private set; } = new List(); /// /// Contains the amount of gamepads that are currently connected. Note that this value will be set to 0 if is false. /// This field is automatically updated in . @@ -342,6 +342,7 @@ namespace MLEM.Input { } } else { this.TouchState = new TouchCollection(InputHandler.EmptyTouchLocations); + this.ViewportTouchState = this.TouchState; this.gestures.Clear(); }