From dd9983058e423898170307b21ea761b416c35b5f Mon Sep 17 00:00:00 2001 From: kugiigi Date: Wed, 30 Dec 2020 12:49:49 +0800 Subject: [PATCH] bottom edge tweaks --- src/app/webbrowser/BottomEdgeHandle.qml | 4 +++- src/app/webbrowser/Browser.qml | 29 ++++++++++++++++--------- src/app/webbrowser/NavigationBar.qml | 18 --------------- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/app/webbrowser/BottomEdgeHandle.qml b/src/app/webbrowser/BottomEdgeHandle.qml index 5128ff2eb..d7ec26aa6 100644 --- a/src/app/webbrowser/BottomEdgeHandle.qml +++ b/src/app/webbrowser/BottomEdgeHandle.qml @@ -22,7 +22,9 @@ import Ubuntu.Components 1.3 SwipeArea { direction: SwipeArea.Upwards - readonly property real dragFraction: dragging ? Math.min(1.0, Math.max(0.0, distance / parent.height)) : 0.0 + readonly property real dragFraction: Math.min(1.0, Math.max(0.0, distance / parent.height)) readonly property var thresholds: [0.05, 0.18, 0.36, 0.54, 1.0] readonly property int stage: thresholds.map(function(t) { return dragFraction <= t }).indexOf(true) + + immediateRecognition: true } diff --git a/src/app/webbrowser/Browser.qml b/src/app/webbrowser/Browser.qml index 26fa7fc42..8f2750e5d 100644 --- a/src/app/webbrowser/Browser.qml +++ b/src/app/webbrowser/Browser.qml @@ -560,7 +560,6 @@ Common.BrowserView { if (visible) { currentWebview.hideContextMenu(); - chrome.state = "hidden"; } else { chrome.state = "shown"; @@ -570,6 +569,12 @@ Common.BrowserView { states: State { name: "shown" } + + onStateChanged: { + if (state === "shown") { + chrome.state = "hidden"; + } + } function closeAndSwitchToTab(index) { recentView.reset() @@ -584,16 +589,20 @@ Common.BrowserView { model: tabsModel readonly property real delegateMinHeight: units.gu(20) delegateHeight: { - if (recentView.state == "shown") { - return Math.max(height / 3, delegateMinHeight) - } else if (bottomEdgeHandle.stage == 0) { - return height - } else if (bottomEdgeHandle.stage == 1) { - return (1 - 1.8 * bottomEdgeHandle.dragFraction) * height - } else if (bottomEdgeHandle.stage >= 2) { - return Math.max(height / 3, delegateMinHeight) + if (recentView.visible) { + if (recentView.state == "shown") { + return Math.max(height / 3, delegateMinHeight) + } else if (bottomEdgeHandle.stage == 0) { + return height + } else if (bottomEdgeHandle.stage == 1) { + return (1 - 1.8 * bottomEdgeHandle.dragFraction) * height + } else if (bottomEdgeHandle.stage >= 2) { + return Math.max(height / 3, delegateMinHeight) + } else { + return delegateMinHeight + } } else { - return delegateMinHeight + return height } } chromeHeight: chrome.height diff --git a/src/app/webbrowser/NavigationBar.qml b/src/app/webbrowser/NavigationBar.qml index 7b31d4000..c3dfd5a9c 100644 --- a/src/app/webbrowser/NavigationBar.qml +++ b/src/app/webbrowser/NavigationBar.qml @@ -220,24 +220,6 @@ FocusScope { onTriggered: internal.webview.findController.next() } - ChromeButton { - id: closeButton - objectName: "closeButton" - - iconName: "close" - iconSize: 0.3 * height - iconColor: root.iconColor - - height: root.height - width: height * 0.8 - - anchors.verticalCenter: parent.verticalCenter - - visible: tabListMode - - onTriggered: closeTabRequested() - } - ChromeButton { id: drawerButton objectName: "drawerButton"