From c00e35a94852de23b693ce6df40f15694465f047 Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 14 Jul 2020 16:01:51 -0400 Subject: [PATCH] Don't change chat width when showing overlay panes When auto-expanding a pane and showing it as an overlay because of narrow window, make the chat keep the width it had before. This makes the transition less jarring, reduces the amount of text seen through a transparent pane, and fix making one pane overlay expanding the other. --- src/gui/Base/HDrawer.qml | 5 +++++ src/gui/Pages/Chat/Chat.qml | 8 ++++++-- src/gui/UI.qml | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/gui/Base/HDrawer.qml b/src/gui/Base/HDrawer.qml index 11bbb6fc..b93bc6eb 100644 --- a/src/gui/Base/HDrawer.qml +++ b/src/gui/Base/HDrawer.qml @@ -43,6 +43,11 @@ Drawer { property int calculatedMinimumSize: requireDefaultSize ? defaultSize : minimumSize + readonly property int calculatedSizeNoRequiredMinimum: + collapse ? + peekSizeWhileCollapsed : + Math.max(minimumSize, Math.min(preferredSize, maximumSize)) + readonly property int calculatedSize: collapse ? peekSizeWhileCollapsed : diff --git a/src/gui/Pages/Chat/Chat.qml b/src/gui/Pages/Chat/Chat.qml index 0274122a..ee824568 100644 --- a/src/gui/Pages/Chat/Chat.qml +++ b/src/gui/Pages/Chat/Chat.qml @@ -75,14 +75,18 @@ Item { HLoader { id: loader anchors.rightMargin: - ready && roomPane && + ! roomPane ? + 0 : + + ready && ! ( roomPane.requireDefaultSize && roomPane.minimumSize > roomPane.maximumSize && ! roomPane.collapse ) ? roomPane.visibleSize : - 0 + + roomPane.calculatedSizeNoRequiredMinimum anchors.fill: parent visible: ! (ready && roomPane && roomPane.visibleSize >= chat.width) diff --git a/src/gui/UI.qml b/src/gui/UI.qml index 25906f5d..3840018f 100644 --- a/src/gui/UI.qml +++ b/src/gui/UI.qml @@ -134,7 +134,7 @@ Item { anchors.leftMargin: mainPane.requireDefaultSize && mainPane.minimumSize > mainPane.maximumSize ? - 0 : + mainPane.calculatedSizeNoRequiredMinimum : mainPane.visibleSize visible: mainPane.visibleSize < mainUI.width