mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03: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
|
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
|
||||||
|
property int startMouseX
|
||||||
|
property int startMouseY
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: removeAnim
|
id: removeAnim
|
||||||
|
|
@ -53,6 +55,10 @@ MouseEventListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPressed: {
|
||||||
|
startMouseX = mouse.screenX;
|
||||||
|
startMouseY = mouse.screenY;
|
||||||
|
}
|
||||||
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))) {
|
||||||
|
|
@ -78,6 +84,11 @@ MouseEventListener {
|
||||||
return;
|
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.y = mouse.y - draggingApplet.height/2;
|
||||||
draggingApplet.x = mouse.x - draggingApplet.width/2;
|
draggingApplet.x = mouse.x - draggingApplet.width/2;
|
||||||
|
|
||||||
|
|
@ -109,12 +120,12 @@ MouseEventListener {
|
||||||
if (!draggingApplet) {
|
if (!draggingApplet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (draggingApplet.x > -draggingApplet.width/4 && draggingApplet.x < draggingApplet.width/4) {
|
if (draggingApplet.x > -draggingApplet.width/4 && draggingApplet.x < draggingApplet.width/4) {
|
||||||
draggingApplet.x = 0;
|
draggingApplet.x = 0;
|
||||||
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
||||||
draggingApplet.animationsEnabled = true;
|
draggingApplet.animationsEnabled = true;
|
||||||
} else {
|
} else {
|
||||||
//draggingApplet.applet.action("remove").trigger();
|
|
||||||
removeAnim.target = draggingApplet;
|
removeAnim.target = draggingApplet;
|
||||||
removeAnim.to = (draggingApplet.x > 0) ? root.width : -root.width
|
removeAnim.to = (draggingApplet.x > 0) ? root.width : -root.width
|
||||||
removeAnim.running = true;
|
removeAnim.running = true;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.2
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
|
@ -34,12 +34,33 @@ Rectangle {
|
||||||
|
|
||||||
color: Qt.rgba(0, 0, 0, 0.8)
|
color: Qt.rgba(0, 0, 0, 0.8)
|
||||||
visible: false
|
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 {
|
MouseArea {
|
||||||
enabled: listView.visible
|
enabled: listView.visible
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
onClicked: editOverlay.visible = false;
|
onClicked: editOverlay.opacity = 0;
|
||||||
}
|
}
|
||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
id: background
|
id: background
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue