From ed8b34d5edf45e132ada94c6f5f96310955dcf20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 28 May 2017 21:11:46 +0900 Subject: [PATCH] Fix drift when dragging chat beyond bounds --- osu.Game/Overlays/ChatOverlay.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 686a1d513a..fec5f11129 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -135,17 +135,20 @@ namespace osu.Game.Overlays channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel; } + private double startDragChatHeight; + protected override bool OnDragStart(InputState state) { - if (channelTabs.Hovering) - return true; + if (!channelTabs.Hovering) + return base.OnDragStart(state); - return base.OnDragStart(state); + startDragChatHeight = chatHeight.Value; + return true; } protected override bool OnDrag(InputState state) { - chatHeight.Value = Height - state.Mouse.Delta.Y / Parent.DrawSize.Y; + chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; return base.OnDrag(state); }