1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 09:37:23 +08:00

Merge pull request #870 from peppy/fix-chat-overlay-drift

Fix drift when dragging chat beyond bounds
This commit is contained in:
Dean Herbert 2017-05-28 22:46:17 +09:00 committed by GitHub
commit edc650d2eb

View File

@ -135,17 +135,22 @@ namespace osu.Game.Overlays
channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel; channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel;
} }
private double startDragChatHeight;
protected override bool OnDragStart(InputState state) protected override bool OnDragStart(InputState state)
{ {
if (channelTabs.Hovering) if (!channelTabs.Hovering)
return true; return base.OnDragStart(state);
return base.OnDragStart(state); startDragChatHeight = chatHeight.Value;
return true;
} }
protected override bool OnDrag(InputState state) protected override bool OnDrag(InputState state)
{ {
chatHeight.Value = Height - state.Mouse.Delta.Y / Parent.DrawSize.Y; Trace.Assert(state.Mouse.PositionMouseDown != null);
chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y;
return base.OnDrag(state); return base.OnDrag(state);
} }