1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-23 17:13:38 +02:00

made the new changes work correctly with touch input

This commit is contained in:
Ell 2022-02-06 22:23:41 +01:00
parent 48b96a10a4
commit 0918e1700b

View file

@ -288,13 +288,14 @@ namespace MLEM.Input {
this.LastViewportTouchState = this.ViewportTouchState;
this.TouchState = active ? TouchPanel.GetState() : default;
this.ViewportTouchState = this.TouchState;
if (this.ViewportTouchState.Count > 0 && this.ViewportOffset != Point.Zero) {
for (var i = 0; i < this.ViewportTouchState.Count; i++) {
var touch = this.ViewportTouchState[i];
if (this.TouchState.Count > 0 && this.ViewportOffset != Point.Zero) {
this.ViewportTouchState = new List<TouchLocation>();
foreach (var touch in this.TouchState) {
touch.TryGetPreviousLocation(out var previous);
this.ViewportTouchState[i] = new TouchLocation(touch.Id, touch.State, touch.Position + this.ViewportOffset.ToVector2(), previous.State, previous.Position + this.ViewportOffset.ToVector2());
this.ViewportTouchState.Add(new TouchLocation(touch.Id, touch.State, touch.Position + this.ViewportOffset.ToVector2(), previous.State, previous.Position + this.ViewportOffset.ToVector2()));
}
} else {
this.ViewportTouchState = this.TouchState;
}
this.gestures.Clear();