mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
attempt of animation when moving plasmoids around
This commit is contained in:
parent
79af925af8
commit
037102220b
2 changed files with 53 additions and 2 deletions
|
|
@ -45,6 +45,7 @@ MouseEventListener {
|
|||
draggingApplet = appletsSpace.layout.childAt(pos.x, pos.y);
|
||||
|
||||
if (draggingApplet) {
|
||||
draggingApplet.animationsEnabled = false;
|
||||
dndSpacer.Layout.minimumHeight = draggingApplet.height;
|
||||
LayoutManager.insertBefore(draggingApplet, dndSpacer);
|
||||
draggingApplet.parent = headerItem;
|
||||
|
|
@ -95,6 +96,7 @@ MouseEventListener {
|
|||
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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ Item {
|
|||
// Fall through to determining an appropriate insert position.
|
||||
} else {
|
||||
var before = null;
|
||||
container.animationsEnabled = false;
|
||||
//container.animationsEnabled = false;
|
||||
|
||||
if (before) {
|
||||
LayoutManager.insertBefore(before, container);
|
||||
|
|
@ -158,7 +158,7 @@ Item {
|
|||
MouseArea {
|
||||
id: appletContainer
|
||||
//not used yet
|
||||
property bool animationsEnabled: false
|
||||
property bool animationsEnabled: true
|
||||
property Item applet
|
||||
z: applet && applet.compactRepresentationItem && applet.expanded ? 99 : 0
|
||||
opacity: 1/Math.abs(x/(width/2))
|
||||
|
|
@ -186,6 +186,14 @@ Item {
|
|||
applet.anchors.margins = background.margins.top;
|
||||
}
|
||||
}
|
||||
onAnimationsEnabledChanged: {
|
||||
if (!animationsEnabled) {
|
||||
translation.x = 0;
|
||||
translation.y = 0;
|
||||
}
|
||||
}
|
||||
property int oldX: x
|
||||
property int oldY: y
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: background
|
||||
z: -1
|
||||
|
|
@ -202,6 +210,47 @@ Item {
|
|||
|
||||
Layout.maximumWidth: root.width
|
||||
Layout.maximumHeight: Layout.minimumHeight
|
||||
|
||||
PlasmaComponents.BusyIndicator {
|
||||
z: 1000
|
||||
visible: applet && applet.busy
|
||||
running: visible
|
||||
anchors.centerIn: parent
|
||||
width: Math.min(parent.width, parent.height)
|
||||
height: width
|
||||
}
|
||||
onXChanged: {
|
||||
if (!animationsEnabled) {
|
||||
return;
|
||||
}
|
||||
translation.x = oldX - x;
|
||||
translation.y = oldY - y;
|
||||
translAnim.running = true;
|
||||
oldX = x;
|
||||
oldY = y;
|
||||
}
|
||||
onYChanged: {
|
||||
if (!animationsEnabled) {
|
||||
return;
|
||||
}
|
||||
translation.x = oldX - x;
|
||||
translation.y = oldY - y;
|
||||
translAnim.running = true;
|
||||
oldX = x;
|
||||
oldY = y;
|
||||
}
|
||||
transform: Translate {
|
||||
id: translation
|
||||
onYChanged: print(y)
|
||||
}
|
||||
NumberAnimation {
|
||||
id: translAnim
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
target: translation
|
||||
properties: "x,y"
|
||||
to: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue