mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
animate editoverlay fade
remove editoverlay after moving the cursor a lot
This commit is contained in:
parent
2c574faa3a
commit
3751f69d40
2 changed files with 35 additions and 3 deletions
|
|
@ -36,6 +36,8 @@ MouseEventListener {
|
|||
height: mainLayout.Layout.minimumHeight
|
||||
property int margin: stripe.height + units.gridUnit * 2
|
||||
property Item draggingApplet
|
||||
property int startMouseX
|
||||
property int startMouseY
|
||||
|
||||
SequentialAnimation {
|
||||
id: removeAnim
|
||||
|
|
@ -53,6 +55,10 @@ MouseEventListener {
|
|||
}
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
startMouseX = mouse.screenX;
|
||||
startMouseY = mouse.screenY;
|
||||
}
|
||||
onPressAndHold: {
|
||||
print(favoritesView.contains(mapToItem(favoritesView, mouse.x, mouse.y)))
|
||||
if (!root.locked && !favoritesView.contains(mapToItem(favoritesView, mouse.x, mouse.y))) {
|
||||
|
|
@ -78,6 +84,11 @@ MouseEventListener {
|
|||
return;
|
||||
}
|
||||
|
||||
if (Math.abs(mouse.screenX - startMouseX) > units.gridUnit ||
|
||||
Math.abs(mouse.screenY - startMouseY) > units.gridUnit) {
|
||||
editOverlay.opacity = 0;
|
||||
}
|
||||
|
||||
draggingApplet.y = mouse.y - draggingApplet.height/2;
|
||||
draggingApplet.x = mouse.x - draggingApplet.width/2;
|
||||
|
||||
|
|
@ -109,12 +120,12 @@ MouseEventListener {
|
|||
if (!draggingApplet) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (draggingApplet.x > -draggingApplet.width/4 && draggingApplet.x < draggingApplet.width/4) {
|
||||
draggingApplet.x = 0;
|
||||
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
||||
draggingApplet.animationsEnabled = true;
|
||||
} else {
|
||||
//draggingApplet.applet.action("remove").trigger();
|
||||
removeAnim.target = draggingApplet;
|
||||
removeAnim.to = (draggingApplet.x > 0) ? root.width : -root.width
|
||||
removeAnim.running = true;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
|
@ -34,12 +34,33 @@ Rectangle {
|
|||
|
||||
color: Qt.rgba(0, 0, 0, 0.8)
|
||||
visible: false
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
opacity = 1;
|
||||
}
|
||||
}
|
||||
opacity: 0
|
||||
Behavior on opacity {
|
||||
SequentialAnimation {
|
||||
OpacityAnimator {
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
ScriptAction {
|
||||
script: {
|
||||
if (editOverlay.opacity == 0) {
|
||||
editOverlay.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
enabled: listView.visible
|
||||
anchors.fill: parent
|
||||
preventStealing: true
|
||||
onClicked: editOverlay.visible = false;
|
||||
onClicked: editOverlay.opacity = 0;
|
||||
}
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: background
|
||||
|
|
|
|||
Loading…
Reference in a new issue