1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 08:47:24 +08:00

Merge pull request #1047 from EVAST9919/chat_dragging

Allow ChatOverlay resize only if it dragged by tabs area only
This commit is contained in:
Dean Herbert 2017-07-28 12:56:39 +09:00 committed by GitHub
commit bd79a69e2e

View File

@ -52,6 +52,7 @@ namespace osu.Game.Overlays
private readonly ChatTabControl channelTabs;
private readonly Container chatContainer;
private readonly Container tabsArea;
private readonly Box chatBackground;
private readonly Box tabBackground;
@ -144,7 +145,7 @@ namespace osu.Game.Overlays
loading = new LoadingAnimation(),
}
},
new Container
tabsArea = new Container
{
Name = @"tabs area",
RelativeSizeAxes = Axes.X,
@ -191,10 +192,13 @@ namespace osu.Game.Overlays
}
private double startDragChatHeight;
private bool isDragging;
protected override bool OnDragStart(InputState state)
{
if (!channelTabs.IsHovered)
isDragging = tabsArea.IsHovered;
if (!isDragging)
return base.OnDragStart(state);
startDragChatHeight = chatHeight.Value;
@ -203,10 +207,20 @@ namespace osu.Game.Overlays
protected override bool OnDrag(InputState state)
{
Trace.Assert(state.Mouse.PositionMouseDown != null);
if (isDragging)
{
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);
chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y;
}
return true;
}
protected override bool OnDragEnd(InputState state)
{
isDragging = false;
return base.OnDragEnd(state);
}
public void APIStateChanged(APIAccess api, APIState state)