Files
DankMaterialShell/quickshell/Modules/Notifications/NotificationSwipeGroup.qml
T
2026-09-30 14:02:48 -04:00

35 lines
791 B
QML

import QtQuick
QtObject {
property Item row: null
property real translation: 0
property bool detached: false
function begin(item) {
if (row)
return;
translation = 0;
detached = false;
row = item;
}
function drag(item, value) {
if (row !== item)
return;
const distance = Math.abs(value);
if (!detached && distance >= NotificationMetrics.swipeDetachDistance)
detached = true;
else if (detached && distance <= NotificationMetrics.swipeAttachDistance)
detached = false;
translation = value;
}
function end(item) {
if (row !== item)
return;
row = null;
detached = false;
translation = 0;
}
}