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

Commit

Permalink
bottom edge tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kugiigi committed Dec 30, 2020
1 parent ac00e62 commit dd99830
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 29 deletions.
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 @@ -560,7 +560,6 @@ Common.BrowserView {
if (visible) {

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

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

function closeAndSwitchToTab(index) {
recentView.reset()
Expand All @@ -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
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 @@ -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"
Expand Down

0 comments on commit dd99830

Please sign in to comment.