Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Bottom edge tweaks #435

Open
wants to merge 2 commits into
base: xenial
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/app/webbrowser/BottomEdgeHandle.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
29 changes: 19 additions & 10 deletions src/app/webbrowser/Browser.qml
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ Common.BrowserView {
if (visible) {

currentWebview.hideContextMenu();
chrome.state = "hidden";
}
else {
chrome.state = "shown";
Expand All @@ -588,6 +587,12 @@ Common.BrowserView {
states: State {
name: "shown"
}

onStateChanged: {
if (state === "shown") {
chrome.state = "hidden";
}
}

function closeAndSwitchToTab(index) {
recentView.reset()
Expand All @@ -602,16 +607,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
Expand Down
18 changes: 0 additions & 18 deletions src/app/webbrowser/NavigationBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -224,24 +224,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: downloadsButton
objectName: "downloadsButton"
Expand Down