mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 10:44:46 +00:00
drag applets from the place they are, not the cursor
fix applet transparency when they are dragged out of the screen to delete them
This commit is contained in:
parent
d4d7c4e7bc
commit
baae0fb1ce
3 changed files with 14 additions and 14 deletions
|
|
@ -36,6 +36,8 @@ MouseEventListener {
|
||||||
property Item draggingApplet
|
property Item draggingApplet
|
||||||
property int startMouseX
|
property int startMouseX
|
||||||
property int startMouseY
|
property int startMouseY
|
||||||
|
property int oldMouseX
|
||||||
|
property int oldMouseY
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: removeAnim
|
id: removeAnim
|
||||||
|
|
@ -56,6 +58,8 @@ MouseEventListener {
|
||||||
onPressed: {
|
onPressed: {
|
||||||
startMouseX = mouse.screenX;
|
startMouseX = mouse.screenX;
|
||||||
startMouseY = mouse.screenY;
|
startMouseY = mouse.screenY;
|
||||||
|
oldMouseX = mouse.screenX;
|
||||||
|
oldMouseY = mouse.screenY;
|
||||||
}
|
}
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
print(favoritesView.contains(mapToItem(favoritesView, mouse.x, mouse.y)))
|
print(favoritesView.contains(mapToItem(favoritesView, mouse.x, mouse.y)))
|
||||||
|
|
@ -82,13 +86,16 @@ MouseEventListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applicationsView.interactive = false;
|
||||||
if (Math.abs(mouse.screenX - startMouseX) > units.gridUnit ||
|
if (Math.abs(mouse.screenX - startMouseX) > units.gridUnit ||
|
||||||
Math.abs(mouse.screenY - startMouseY) > units.gridUnit) {
|
Math.abs(mouse.screenY - startMouseY) > units.gridUnit) {
|
||||||
editOverlay.opacity = 0;
|
editOverlay.opacity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
draggingApplet.y = mouse.y - draggingApplet.height/2;
|
draggingApplet.x -= oldMouseX - mouse.screenX;
|
||||||
draggingApplet.x = mouse.x - draggingApplet.width/2;
|
draggingApplet.y -= oldMouseY - mouse.screenY;
|
||||||
|
oldMouseX = mouse.screenX;
|
||||||
|
oldMouseY = mouse.screenY;
|
||||||
|
|
||||||
var pos = mapToItem(appletsLayout, mouse.x, mouse.y);
|
var pos = mapToItem(appletsLayout, mouse.x, mouse.y);
|
||||||
var itemUnderMouse = appletsSpace.layout.childAt(pos.x, pos.y);
|
var itemUnderMouse = appletsSpace.layout.childAt(pos.x, pos.y);
|
||||||
|
|
@ -119,10 +126,9 @@ MouseEventListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (draggingApplet.x > -draggingApplet.width/4 && draggingApplet.x < draggingApplet.width/4) {
|
if (draggingApplet.x > -draggingApplet.width/3 && draggingApplet.x < draggingApplet.width/3) {
|
||||||
draggingApplet.x = 0;
|
draggingApplet.x = 0;
|
||||||
root.layoutManager.insertBefore( dndSpacer, draggingApplet);
|
root.layoutManager.insertBefore( dndSpacer, draggingApplet);
|
||||||
draggingApplet.animationsEnabled = true;
|
|
||||||
} else {
|
} else {
|
||||||
removeAnim.target = draggingApplet;
|
removeAnim.target = draggingApplet;
|
||||||
removeAnim.to = (draggingApplet.x > 0) ? root.width : -root.width
|
removeAnim.to = (draggingApplet.x > 0) ? root.width : -root.width
|
||||||
|
|
@ -184,13 +190,6 @@ MouseEventListener {
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add: Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
properties: "x,y"
|
|
||||||
duration: units.longDuration
|
|
||||||
easing.type: Easing.InOutQuad
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
id: dndSpacer
|
id: dndSpacer
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ Rectangle {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: parent.margins.top
|
topMargin: parent.margins.top
|
||||||
}
|
}
|
||||||
PlasmaComponents.Button {
|
PlasmaComponents.ToolButton {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight:true
|
Layout.fillHeight:true
|
||||||
text: i18n("Wallpaper...")
|
text: i18n("Wallpaper...")
|
||||||
|
|
@ -90,7 +90,7 @@ Rectangle {
|
||||||
editOverlay.opacity = 0;
|
editOverlay.opacity = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlasmaComponents.Button {
|
PlasmaComponents.ToolButton {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight:true
|
Layout.fillHeight:true
|
||||||
text: i18n("Add Widgets...")
|
text: i18n("Add Widgets...")
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ Item {
|
||||||
property bool animationsEnabled: true
|
property bool animationsEnabled: true
|
||||||
property Item applet
|
property Item applet
|
||||||
z: applet && applet.compactRepresentationItem && applet.expanded ? 99 : 0
|
z: applet && applet.compactRepresentationItem && applet.expanded ? 99 : 0
|
||||||
opacity: 1/Math.abs(x/(width/2))
|
opacity: 1 - Math.abs(x/(width/2))
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: applet && applet.Layout.fillHeight
|
Layout.fillHeight: applet && applet.Layout.fillHeight
|
||||||
|
|
||||||
|
|
@ -257,6 +257,7 @@ Item {
|
||||||
z: 999
|
z: 999
|
||||||
}
|
}
|
||||||
MouseEventListener {
|
MouseEventListener {
|
||||||
|
id: mainListener
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
//Events handling: those events are about clicking and reordering of app icons
|
//Events handling: those events are about clicking and reordering of app icons
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue