From 31bfaaee7aec7f1d61fd702faffd8276ce6056e5 Mon Sep 17 00:00:00 2001 From: Roman Shapiro Date: Sat, 11 Jan 2020 00:33:25 +0700 Subject: [PATCH] Fixes #154 --- src/Myra/Graphics2D/UI/Desktop.cs | 19 ------------------- src/Myra/Graphics2D/UI/Widget.cs | 6 ++++-- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/Myra/Graphics2D/UI/Desktop.cs b/src/Myra/Graphics2D/UI/Desktop.cs index 9f4c0010..3a977993 100644 --- a/src/Myra/Graphics2D/UI/Desktop.cs +++ b/src/Myra/Graphics2D/UI/Desktop.cs @@ -65,7 +65,6 @@ public static class Desktop private static Widget _scheduleMouseWheelFocus; private static bool _isTouchDown; private static Point _mousePosition, _touchPosition; - private static Point _lastMousePosition, _lastTouchPosition; private static bool _contextMenuShown = false; private static bool _keyboardFocusSet = false; private static bool _mouseWheelFocusSet = false; @@ -81,14 +80,6 @@ public static IReadOnlyCollection DownKeys } } - internal static Point LastMousePosition - { - get - { - return _lastMousePosition; - } - } - public static Point MousePosition { get @@ -103,7 +94,6 @@ private set return; } - _lastMousePosition = _mousePosition; _mousePosition = value; MouseMoved.Invoke(); @@ -126,14 +116,6 @@ private set } } - internal static Point LastTouchPosition - { - get - { - return _lastTouchPosition; - } - } - public static Point TouchPosition { get @@ -148,7 +130,6 @@ private set return; } - _lastTouchPosition = _touchPosition; _touchPosition = value; TouchMoved.Invoke(); diff --git a/src/Myra/Graphics2D/UI/Widget.cs b/src/Myra/Graphics2D/UI/Widget.cs index 34e2daa9..5532d9ae 100644 --- a/src/Myra/Graphics2D/UI/Widget.cs +++ b/src/Myra/Graphics2D/UI/Widget.cs @@ -998,6 +998,8 @@ public virtual void UpdateLayout() _lastLocationHint = new Point(Left, Top); _layoutState = LayoutState.Normal; + HandleMouseMovement(); + LayoutUpdated.Invoke(this); } @@ -1281,7 +1283,7 @@ internal void HandleTouchDoubleClick() internal bool HandleMouseMovement() { var isMouseOver = Bounds.Contains(Desktop.MousePosition); - var wasMouseOver = Bounds.Contains(Desktop.LastMousePosition); + var wasMouseOver = IsMouseInside; if (isMouseOver && !wasMouseOver) { @@ -1330,7 +1332,7 @@ internal void HandleTouchUp() internal bool HandleTouchMovement() { var isTouchOver = Bounds.Contains(Desktop.TouchPosition); - var wasTouchOver = Bounds.Contains(Desktop.LastTouchPosition); + var wasTouchOver = IsTouchInside; if (isTouchOver && !wasTouchOver) {