zoom out items when moving

This commit is contained in:
Marco Martin 2015-03-05 14:02:32 +01:00
parent c0d4d075af
commit ba089aa1dd
2 changed files with 15 additions and 5 deletions

View file

@ -4,22 +4,31 @@ import org.kde.kio 1.0 as Kio
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 2.0 as PlasmaComponents
MouseArea { MouseArea {
id: root id: delegateRoot
width: applicationsView.cellWidth width: applicationsView.cellWidth
height: width height: width
scale: root.reorderingApps && !drag.target ? 0.6 : 1
Behavior on scale {
NumberAnimation {
duration: units.shortDuration
easing.type: Easing.InOutQuad
}
}
onClicked: { onClicked: {
console.log("Clicked: " + model.ApplicationStorageIdRole) console.log("Clicked: " + model.ApplicationStorageIdRole)
appListModel.runApplication(model.ApplicationStorageIdRole) appListModel.runApplication(model.ApplicationStorageIdRole)
} }
onPressAndHold: { onPressAndHold: {
root.drag.target = root; delegateRoot.drag.target = delegateRoot;
root.reorderingApps = true;
} }
onReleased: { onReleased: {
root.drag.target = null; delegateRoot.drag.target = null;
root.reorderingApps = false;
} }
onPositionChanged: { onPositionChanged: {
if (root.drag.target) { if (delegateRoot.drag.target) {
appListModel.setOrder(model.ApplicationOriginalRowRole, (Math.round(GridView.view.width / GridView.view.cellWidth) * Math.round(root.y / GridView.view.cellHeight) + Math.round(root.x / GridView.view.cellWidth))); appListModel.setOrder(model.ApplicationOriginalRowRole, (Math.round(GridView.view.width / GridView.view.cellWidth) * Math.round(delegateRoot.y / GridView.view.cellHeight) + Math.round(delegateRoot.x / GridView.view.cellWidth)));
} }
} }

View file

@ -33,6 +33,7 @@ Item {
property Item toolBox property Item toolBox
property alias appletsSpace: applicationsView.headerItem property alias appletsSpace: applicationsView.headerItem
property int buttonHeight: width/4 property int buttonHeight: width/4
property bool reorderingApps: false
SatelliteComponents.ApplicationListModel { SatelliteComponents.ApplicationListModel {
id: appListModel id: appListModel