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

Clamp maximum and minimum height the chat overlay can be resized to

This commit is contained in:
Jai Sharma 2022-05-05 21:39:31 +01:00
parent e2895ea145
commit 16a6c11bc8

View File

@ -3,6 +3,7 @@
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
@ -44,8 +45,11 @@ namespace osu.Game.Overlays
private bool isDraggingTopBar;
private float dragStartChatHeight;
private const int transition_length = 500;
private const float min_chat_height = 0.2f;
private const float max_chat_height = 1f;
private const float default_chat_height = 0.4f;
private const int transition_length = 500;
private const float top_bar_height = 40;
private const float side_bar_width = 190;
private const float chat_bar_height = 60;
@ -215,7 +219,7 @@ namespace osu.Game.Overlays
return;
float targetChatHeight = dragStartChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y;
chatHeight.Value = targetChatHeight;
chatHeight.Value = Math.Clamp(targetChatHeight, min_chat_height, max_chat_height);
}
protected override void OnDragEnd(DragEndEvent e)