diff --git a/containments/homescreen/package/contents/ui/AppletsArea.qml b/containments/homescreen/package/contents/ui/AppletsArea.qml index 3aa70b0c..7f4b9b28 100644 --- a/containments/homescreen/package/contents/ui/AppletsArea.qml +++ b/containments/homescreen/package/contents/ui/AppletsArea.qml @@ -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; diff --git a/containments/homescreen/package/contents/ui/EditOverlay.qml b/containments/homescreen/package/contents/ui/EditOverlay.qml index 3c5c8820..ab2a1920 100644 --- a/containments/homescreen/package/contents/ui/EditOverlay.qml +++ b/containments/homescreen/package/contents/ui/EditOverlay.qml @@ -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