mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
start of scrolling by dragging when reordering
This commit is contained in:
parent
72d2df24c7
commit
9a8f90681b
2 changed files with 61 additions and 0 deletions
|
|
@ -63,6 +63,7 @@ ContainmentLayoutManager.ItemContainer {
|
|||
launcherDragManager.dropItem(delegate, dragCenterX, dragCenterY);
|
||||
plasmoid.editMode = false;
|
||||
editMode = false;
|
||||
plasmoid.fullRepresentationItem.stopScroll();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +71,18 @@ ContainmentLayoutManager.ItemContainer {
|
|||
dragCenterX = dragCenter.x;
|
||||
dragCenterY = dragCenter.y;
|
||||
launcherDragManager.dragItem(delegate, dragCenter.x, dragCenter.y);
|
||||
|
||||
var pos = plasmoid.fullRepresentationItem.mapFromItem(delegate, dragCenter.x, dragCenter.y);
|
||||
//SCROLL UP
|
||||
if (pos.y < plasmoid.fullRepresentationItem.height / 4) {
|
||||
plasmoid.fullRepresentationItem.scrollUp();
|
||||
//SCROLL DOWN
|
||||
} else if (pos.y > 3 * (plasmoid.fullRepresentationItem.height / 4)) {
|
||||
plasmoid.fullRepresentationItem.scrollDown();
|
||||
//DON't SCROLL
|
||||
} else {
|
||||
plasmoid.fullRepresentationItem.stopScroll();
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: MouseArea {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,46 @@ Text {
|
|||
color: "white"
|
||||
visible: plasmoid.editMode
|
||||
}
|
||||
|
||||
//BEGIN functions
|
||||
//Autoscroll related functions
|
||||
function scrollUp() {
|
||||
autoScrollTimer.scrollDown = false;
|
||||
autoScrollTimer.running = true;
|
||||
// scrollUpIndicator.opacity = 1;
|
||||
// scrollDownIndicator.opacity = 0;
|
||||
}
|
||||
|
||||
function scrollDown() {
|
||||
autoScrollTimer.scrollDown = true;
|
||||
autoScrollTimer.running = true;
|
||||
// scrollUpIndicator.opacity = 0;
|
||||
// scrollDownIndicator.opacity = 1;
|
||||
}
|
||||
|
||||
function stopScroll() {
|
||||
autoScrollTimer.running = false;
|
||||
// scrollUpIndicator.opacity = 0;
|
||||
// scrollDownIndicator.opacity = 0;
|
||||
}
|
||||
//END functions
|
||||
|
||||
Timer {
|
||||
id: autoScrollTimer
|
||||
property bool scrollDown: true
|
||||
repeat: true
|
||||
interval: 1500
|
||||
onTriggered: {
|
||||
scrollAnim.to = scrollDown ?
|
||||
//Scroll down
|
||||
Math.min(mainFlickable.contentItem.height - root.height, mainFlickable.contentY + root.height/2) :
|
||||
//Scroll up
|
||||
Math.max(0, mainFlickable.contentY - root.height/2);
|
||||
|
||||
scrollAnim.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: plasmoid
|
||||
onEditModeChanged: {
|
||||
|
|
@ -70,6 +110,14 @@ Text {
|
|||
contentHeight: flickableContents.height
|
||||
interactive: !plasmoid.editMode && !launcher.dragging
|
||||
|
||||
NumberAnimation {
|
||||
id: scrollAnim
|
||||
target: mainFlickable
|
||||
properties: "contentY"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: flickableContents
|
||||
width: parent.width
|
||||
|
|
|
|||
Loading…
Reference in a new issue