mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 02:28:37 +02:00
ported some quickshell stuff from rivendell-hyprdots
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
required property Item item
|
||||
property Animation activeAnimation: null
|
||||
signal animationCompleted(self: SlideViewItem)
|
||||
|
||||
property Connections __animConnection: Connections {
|
||||
target: activeAnimation
|
||||
|
||||
function onStopped() {
|
||||
root.activeAnimation.destroy();
|
||||
root.animationCompleted(root);
|
||||
}
|
||||
}
|
||||
|
||||
function createAnimation(component: Component) {
|
||||
this.stopIfRunning();
|
||||
this.activeAnimation = component.createObject(this, {
|
||||
target: this.item
|
||||
});
|
||||
this.activeAnimation.running = true;
|
||||
}
|
||||
|
||||
function stopIfRunning() {
|
||||
if (this.activeAnimation) {
|
||||
this.activeAnimation.stop();
|
||||
this.activeAnimation = null;
|
||||
}
|
||||
}
|
||||
|
||||
function finishIfRunning() {
|
||||
if (this.activeAnimation) {
|
||||
// animator types dont handle complete correctly.
|
||||
this.activeAnimation.complete();
|
||||
this.activeAnimation.stop();
|
||||
this.item.x = 0;
|
||||
this.item.y = 0;
|
||||
this.activeAnimation = null;
|
||||
}
|
||||
}
|
||||
|
||||
function destroyAll() {
|
||||
this.item.destroy();
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user