mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 10:44:46 +00:00
animated applet remove
This commit is contained in:
parent
70551d7ad6
commit
2c574faa3a
1 changed files with 22 additions and 4 deletions
|
|
@ -36,7 +36,23 @@ MouseEventListener {
|
||||||
height: mainLayout.Layout.minimumHeight
|
height: mainLayout.Layout.minimumHeight
|
||||||
property int margin: stripe.height + units.gridUnit * 2
|
property int margin: stripe.height + units.gridUnit * 2
|
||||||
property Item draggingApplet
|
property Item draggingApplet
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: removeAnim
|
||||||
|
property Item target
|
||||||
|
property real to
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "x"
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
target: removeAnim.target
|
||||||
|
to: removeAnim.to
|
||||||
|
}
|
||||||
|
ScriptAction {
|
||||||
|
script: removeAnim.target.applet.action("remove").trigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
print(favoritesView.contains(mapToItem(favoritesView, mouse.x, mouse.y)))
|
print(favoritesView.contains(mapToItem(favoritesView, mouse.x, mouse.y)))
|
||||||
if (!root.locked && !favoritesView.contains(mapToItem(favoritesView, mouse.x, mouse.y))) {
|
if (!root.locked && !favoritesView.contains(mapToItem(favoritesView, mouse.x, mouse.y))) {
|
||||||
|
|
@ -98,7 +114,10 @@ MouseEventListener {
|
||||||
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
||||||
draggingApplet.animationsEnabled = true;
|
draggingApplet.animationsEnabled = true;
|
||||||
} else {
|
} else {
|
||||||
draggingApplet.applet.action("remove").trigger();
|
//draggingApplet.applet.action("remove").trigger();
|
||||||
|
removeAnim.target = draggingApplet;
|
||||||
|
removeAnim.to = (draggingApplet.x > 0) ? root.width : -root.width
|
||||||
|
removeAnim.running = true;
|
||||||
}
|
}
|
||||||
applicationsView.interactive = true;
|
applicationsView.interactive = true;
|
||||||
dndSpacer.parent = colorScope;
|
dndSpacer.parent = colorScope;
|
||||||
|
|
@ -134,9 +153,8 @@ MouseEventListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Item {
|
||||||
id: spacer
|
id: spacer
|
||||||
radius: 20
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: plasmoid.availableScreenRect.height/4
|
height: plasmoid.availableScreenRect.height/4
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue