mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 02:34:45 +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);
|
launcherDragManager.dropItem(delegate, dragCenterX, dragCenterY);
|
||||||
plasmoid.editMode = false;
|
plasmoid.editMode = false;
|
||||||
editMode = false;
|
editMode = false;
|
||||||
|
plasmoid.fullRepresentationItem.stopScroll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,6 +71,18 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
dragCenterX = dragCenter.x;
|
dragCenterX = dragCenter.x;
|
||||||
dragCenterY = dragCenter.y;
|
dragCenterY = dragCenter.y;
|
||||||
launcherDragManager.dragItem(delegate, dragCenter.x, 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 {
|
contentItem: MouseArea {
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,46 @@ Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
visible: plasmoid.editMode
|
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 {
|
Connections {
|
||||||
target: plasmoid
|
target: plasmoid
|
||||||
onEditModeChanged: {
|
onEditModeChanged: {
|
||||||
|
|
@ -70,6 +110,14 @@ Text {
|
||||||
contentHeight: flickableContents.height
|
contentHeight: flickableContents.height
|
||||||
interactive: !plasmoid.editMode && !launcher.dragging
|
interactive: !plasmoid.editMode && !launcher.dragging
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
id: scrollAnim
|
||||||
|
target: mainFlickable
|
||||||
|
properties: "contentY"
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: flickableContents
|
id: flickableContents
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue