Commit 9a8f9068 authored by Marco Martin's avatar Marco Martin

start of scrolling by dragging when reordering

parent 72d2df24
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment