fix controlling from the bottom panel

This commit is contained in:
Marco Martin 2021-04-13 14:03:05 +02:00
parent b98c7ec224
commit 8483bcbe0f
4 changed files with 10 additions and 9 deletions

View file

@ -14,8 +14,7 @@ QtObject {
signal resetHomeScreenPosition() signal resetHomeScreenPosition()
signal snapHomeScreenPosition() signal snapHomeScreenPosition()
signal requestHomeScreenPosition(real y) signal requestRelativeScroll(point pos)
property real homeScreenPosition: 0
property Item homeScreen property Item homeScreen
property QtObject homeScreenWindow property QtObject homeScreenWindow
property bool homeScreenVisible: true property bool homeScreenVisible: true

View file

@ -198,7 +198,6 @@ Item {
oldContentY = contentY; oldContentY = contentY;
root.offset = contentY + view.originY + view.height*2 - root.closedPositionOffset*2 root.offset = contentY + view.originY + view.height*2 - root.closedPositionOffset*2
MobileShell.HomeScreenControls.homeScreenPosition = contentY
} }
onMovementEnded: root.snapDrawerStatus() onMovementEnded: root.snapDrawerStatus()
onFlickEnded: movementEnded() onFlickEnded: movementEnded()

View file

@ -76,15 +76,15 @@ FocusScope {
appDrawer.close(); appDrawer.close();
} }
function onSnapHomeScreenPosition() { function onSnapHomeScreenPosition() {
if (lastRequestedPosition > 0) { if (lastRequestedPosition < 0) {
appDrawer.open(); appDrawer.open();
} else { } else {
appDrawer.close(); appDrawer.close();
} }
} }
function onRequestHomeScreenPosition(y) { function onRequestRelativeScroll(pos) {
appDrawer.offset += y; appDrawer.offset -= pos.y;
lastRequestedPosition = y; lastRequestedPosition = pos.y;
} }
} }

View file

@ -95,12 +95,15 @@ PlasmaCore.ColorScope {
anchors.fill: parent anchors.fill: parent
property int oldMouseY: 0 property int oldMouseY: 0
property int startMouseY: 0 property int startMouseY: 0
property int oldMouseX: 0
property int startMouseX: 0
property bool isDragging: false property bool isDragging: false
property bool opening: false property bool opening: false
drag.filterChildren: true drag.filterChildren: true
property Button activeButton property Button activeButton
onPressed: { onPressed: {
startMouseX = oldMouseX = mouse.y;
startMouseY = oldMouseY = mouse.y; startMouseY = oldMouseY = mouse.y;
taskSwitcher.offset = -taskSwitcher.height; taskSwitcher.offset = -taskSwitcher.height;
activeButton = icons.childAt(mouse.x, mouse.y); activeButton = icons.childAt(mouse.x, mouse.y);
@ -125,9 +128,10 @@ PlasmaCore.ColorScope {
taskSwitcher.showFullScreen(); taskSwitcher.showFullScreen();
//no tasks, let's scroll up the homescreen instead //no tasks, let's scroll up the homescreen instead
} else if (taskSwitcher.tasksCount === 0) { } else if (taskSwitcher.tasksCount === 0) {
MobileShell.HomeScreenControls.requestHomeScreenPosition(MobileShell.HomeScreenControls.homeScreenPosition - (mouse.y - oldMouseY)); MobileShell.HomeScreenControls.requestRelativeScroll(Qt.point(mouse.x - oldMouseX, mouse.y - oldMouseY));
} }
oldMouseY = mouse.y; oldMouseY = mouse.y;
oldMouseY = mouse.y;
} }
onReleased: { onReleased: {
if (taskSwitcher.visibility == Window.Hidden) { if (taskSwitcher.visibility == Window.Hidden) {
@ -214,7 +218,6 @@ PlasmaCore.ColorScope {
height: parent.height height: parent.height
width: parent.width*0.8/3 width: parent.width*0.8/3
mouseArea: mainMouseArea mouseArea: mainMouseArea
enabled: !taskSwitcher.visible && (root.showingApp || MobileShell.HomeScreenControls.homeScreenPosition != 0)
onClicked: { onClicked: {
if (!enabled) { if (!enabled) {
return; return;