Remove `!` usage (also seems to fix height saving/loading)

This commit is contained in:
Dean Herbert 2022-05-05 19:16:19 +09:00
parent 25ea660b0b
commit 74505ba166
1 changed files with 6 additions and 4 deletions

View File

@ -39,7 +39,8 @@ public class ChatOverlayV2 : OsuFocusedOverlayContainer, INamedOverlayComponent
private ChatTextBar textBar = null!;
private Container<DrawableChannel> currentChannelContainer = null!;
private Bindable<float>? chatHeight;
private readonly Bindable<float> chatHeight = new Bindable<float>();
private bool isDraggingTopBar;
private float dragStartChatHeight;
@ -137,7 +138,8 @@ protected override void LoadComplete()
loading.Show();
chatHeight = config.GetBindable<float>(OsuSetting.ChatDisplayHeight).GetBoundCopy();
config.BindWith(OsuSetting.ChatDisplayHeight, chatHeight);
chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true);
currentChannel.BindTo(channelManager.CurrentChannel);
@ -193,7 +195,7 @@ protected override bool OnDragStart(DragStartEvent e)
if (!isDraggingTopBar)
return base.OnDragStart(e);
dragStartChatHeight = chatHeight!.Value;
dragStartChatHeight = chatHeight.Value;
return true;
}
@ -203,7 +205,7 @@ protected override void OnDrag(DragEvent e)
return;
float targetChatHeight = dragStartChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y;
chatHeight!.Value = targetChatHeight;
chatHeight.Value = targetChatHeight;
}
protected override void OnDragEnd(DragEndEvent e)