mirror of
https://github.com/ppy/osu.git
synced 2024-09-23 11:27:38 +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:
commit
bd79a69e2e
@ -52,6 +52,7 @@ namespace osu.Game.Overlays
|
|||||||
private readonly ChatTabControl channelTabs;
|
private readonly ChatTabControl channelTabs;
|
||||||
|
|
||||||
private readonly Container chatContainer;
|
private readonly Container chatContainer;
|
||||||
|
private readonly Container tabsArea;
|
||||||
private readonly Box chatBackground;
|
private readonly Box chatBackground;
|
||||||
private readonly Box tabBackground;
|
private readonly Box tabBackground;
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ namespace osu.Game.Overlays
|
|||||||
loading = new LoadingAnimation(),
|
loading = new LoadingAnimation(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Container
|
tabsArea = new Container
|
||||||
{
|
{
|
||||||
Name = @"tabs area",
|
Name = @"tabs area",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -191,10 +192,13 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double startDragChatHeight;
|
private double startDragChatHeight;
|
||||||
|
private bool isDragging;
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state)
|
protected override bool OnDragStart(InputState state)
|
||||||
{
|
{
|
||||||
if (!channelTabs.IsHovered)
|
isDragging = tabsArea.IsHovered;
|
||||||
|
|
||||||
|
if (!isDragging)
|
||||||
return base.OnDragStart(state);
|
return base.OnDragStart(state);
|
||||||
|
|
||||||
startDragChatHeight = chatHeight.Value;
|
startDragChatHeight = chatHeight.Value;
|
||||||
@ -203,10 +207,20 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override bool OnDrag(InputState state)
|
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;
|
chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y;
|
||||||
return base.OnDrag(state);
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragEnd(InputState state)
|
||||||
|
{
|
||||||
|
isDragging = false;
|
||||||
|
return base.OnDragEnd(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(APIAccess api, APIState state)
|
||||||
|
Loading…
Reference in New Issue
Block a user