mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 10:44:46 +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);
|
draggingApplet = appletsSpace.layout.childAt(pos.x, pos.y);
|
||||||
|
|
||||||
if (draggingApplet) {
|
if (draggingApplet) {
|
||||||
|
draggingApplet.animationsEnabled = false;
|
||||||
dndSpacer.Layout.minimumHeight = draggingApplet.height;
|
dndSpacer.Layout.minimumHeight = draggingApplet.height;
|
||||||
LayoutManager.insertBefore(draggingApplet, dndSpacer);
|
LayoutManager.insertBefore(draggingApplet, dndSpacer);
|
||||||
draggingApplet.parent = headerItem;
|
draggingApplet.parent = headerItem;
|
||||||
|
|
@ -95,6 +96,7 @@ MouseEventListener {
|
||||||
if (draggingApplet.x > -draggingApplet.width/4 && draggingApplet.x < draggingApplet.width/4) {
|
if (draggingApplet.x > -draggingApplet.width/4 && draggingApplet.x < draggingApplet.width/4) {
|
||||||
draggingApplet.x = 0;
|
draggingApplet.x = 0;
|
||||||
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
||||||
|
draggingApplet.animationsEnabled = true;
|
||||||
} else {
|
} else {
|
||||||
draggingApplet.applet.action("remove").trigger();
|
draggingApplet.applet.action("remove").trigger();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ Item {
|
||||||
// Fall through to determining an appropriate insert position.
|
// Fall through to determining an appropriate insert position.
|
||||||
} else {
|
} else {
|
||||||
var before = null;
|
var before = null;
|
||||||
container.animationsEnabled = false;
|
//container.animationsEnabled = false;
|
||||||
|
|
||||||
if (before) {
|
if (before) {
|
||||||
LayoutManager.insertBefore(before, container);
|
LayoutManager.insertBefore(before, container);
|
||||||
|
|
@ -158,7 +158,7 @@ Item {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: appletContainer
|
id: appletContainer
|
||||||
//not used yet
|
//not used yet
|
||||||
property bool animationsEnabled: false
|
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))
|
||||||
|
|
@ -186,6 +186,14 @@ Item {
|
||||||
applet.anchors.margins = background.margins.top;
|
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 {
|
PlasmaCore.FrameSvgItem {
|
||||||
id: background
|
id: background
|
||||||
z: -1
|
z: -1
|
||||||
|
|
@ -202,6 +210,47 @@ Item {
|
||||||
|
|
||||||
Layout.maximumWidth: root.width
|
Layout.maximumWidth: root.width
|
||||||
Layout.maximumHeight: Layout.minimumHeight
|
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