mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
better management of dragging to new pages
This commit is contained in:
parent
70805d04eb
commit
dff5809c59
3 changed files with 13 additions and 6 deletions
|
|
@ -14,6 +14,7 @@ import org.kde.plasma.components 3.0 as PC3
|
|||
import org.kde.kirigami 2.10 as Kirigami
|
||||
|
||||
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
|
||||
import org.kde.phone.homescreen 1.0
|
||||
|
||||
|
|
@ -194,6 +195,7 @@ Item {
|
|||
}
|
||||
oldContentY = contentY;
|
||||
root.offset = contentY + view.originY + view.height*2
|
||||
MobileShell.HomeScreenControls.homeScreenPosition = contentY
|
||||
}
|
||||
onMovementEnded: root.snapDrawerStatus()
|
||||
onFlickEnded: movementEnded()
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ Flickable {
|
|||
|
||||
property AppDrawer appDrawer
|
||||
|
||||
readonly property int totalPages: Math.ceil(contentWidth / width)
|
||||
property int currentIndex: 0
|
||||
|
||||
opacity: 1 - appDrawer.openFactor
|
||||
transform: Translate {
|
||||
y: -mainFlickable.height/10 * appDrawer.openFactor
|
||||
|
|
@ -34,7 +37,6 @@ Flickable {
|
|||
scale: (3 - appDrawer.openFactor) /3
|
||||
|
||||
//bottomMargin: favoriteStrip.height
|
||||
contentWidth: appletsLayout.width
|
||||
contentHeight: height
|
||||
//interactive: !plasmoid.editMode && !launcherDragManager.active
|
||||
interactive: false
|
||||
|
|
@ -45,10 +47,11 @@ Flickable {
|
|||
onFlickStarted: cancelEditModeForItemsRequested()
|
||||
onFlickEnded: cancelEditModeForItemsRequested()
|
||||
|
||||
onContentYChanged: MobileShell.HomeScreenControls.homeScreenPosition = contentY
|
||||
onCurrentIndexChanged: contentX = width * currentIndex;
|
||||
onContentXChanged: mainFlickable.currentIndex = Math.floor(contentX / width)
|
||||
|
||||
|
||||
//Autoscroll related functions
|
||||
//Autoscroll related functions
|
||||
function scrollLeft() {
|
||||
if (mainFlickable.atXBeginning) {
|
||||
return;
|
||||
|
|
@ -124,7 +127,7 @@ Flickable {
|
|||
PlasmaCore.ColorScope.inherit: false
|
||||
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||
parent: mainFlickable
|
||||
count: Math.ceil(dropArea.width / mainFlickable.width)
|
||||
count: mainFlickable.totalPages
|
||||
visible: count > 1
|
||||
currentIndex: Math.round(mainFlickable.contentX / mainFlickable.width)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,12 +114,14 @@ FocusScope {
|
|||
}
|
||||
|
||||
appDrawer: appDrawer
|
||||
contentWidth: Math.max(width, width * Math.ceil(appletsLayout.childrenRect.width/width)) + (launcherDragManager.active ? width : 0)
|
||||
|
||||
// TODO: span on multiple pages
|
||||
DragDrop.DropArea {
|
||||
id: dropArea
|
||||
width: Math.max(mainFlickable.width, mainFlickable.width * Math.ceil(appletsLayout.childrenRect.width/mainFlickable.width))
|
||||
height: mainFlickable.height + favoriteStrip.height
|
||||
width: mainFlickable.width * 100
|
||||
//width: Math.max(mainFlickable.width, mainFlickable.width * Math.ceil(appletsLayout.childrenRect.width/mainFlickable.width))
|
||||
height: mainFlickable.height + favoriteStrip.height + units.gridUnit
|
||||
|
||||
onDragEnter: {
|
||||
event.accept(event.proposedAction);
|
||||
|
|
|
|||
Loading…
Reference in a new issue