mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 18:24:46 +00:00
ibetter behavior for dragging
This commit is contained in:
parent
36aa3e5f0b
commit
9999e4ffbf
2 changed files with 12 additions and 19 deletions
|
|
@ -85,5 +85,11 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ Item {
|
||||||
property bool active
|
property bool active
|
||||||
|
|
||||||
readonly property Item spacer: Item {
|
readonly property Item spacer: Item {
|
||||||
width: units.gridUnit * 4
|
width: launcherGrid.cellWidth
|
||||||
height: width
|
height: launcherGrid.cellHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
function startDrag(item) {
|
function startDrag(item) {
|
||||||
|
|
@ -227,25 +227,12 @@ Item {
|
||||||
plasmoid.nativeInterface.applicationListModel.setLocation(item.modelData.index, ApplicationListModel.Grid);
|
plasmoid.nativeInterface.applicationListModel.setLocation(item.modelData.index, ApplicationListModel.Grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
spacer.visible = false;
|
|
||||||
spacer.parent = container;
|
|
||||||
|
|
||||||
var child = nearestChild(item, dragCenterX, dragCenterY, container);
|
var child = nearestChild(item, dragCenterX, dragCenterY, container);
|
||||||
|
|
||||||
if (!child) {
|
putInContainerLayout(item, container);
|
||||||
putInContainerLayout(item, container);
|
plasmoid.nativeInterface.stackBefore(item, spacer);
|
||||||
return;
|
spacer.visible = false;
|
||||||
}
|
spacer.parent = container;
|
||||||
|
|
||||||
var pos = container.flow.mapFromItem(item, dragCenterX, dragCenterY);
|
|
||||||
|
|
||||||
if (pos.x + dragCenterX < child.x + child.width / 2) {
|
|
||||||
putInContainerLayout(item, container);
|
|
||||||
plasmoid.nativeInterface.stackBefore(item, child);
|
|
||||||
} else {
|
|
||||||
putInContainerLayout(item, container);
|
|
||||||
plasmoid.nativeInterface.stackAfter(item, child);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue