diff --git a/containments/homescreen2/package/contents/ui/launcher/Delegate.qml b/containments/homescreen2/package/contents/ui/launcher/Delegate.qml index 4ae3e6b0..3a2c8f7e 100644 --- a/containments/homescreen2/package/contents/ui/launcher/Delegate.qml +++ b/containments/homescreen2/package/contents/ui/launcher/Delegate.qml @@ -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 { diff --git a/containments/homescreen2/package/contents/ui/main.qml b/containments/homescreen2/package/contents/ui/main.qml index a2876f0d..88d34962 100644 --- a/containments/homescreen2/package/contents/ui/main.qml +++ b/containments/homescreen2/package/contents/ui/main.qml @@ -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