This commit is contained in:
Lemmy
2026-02-12 11:25:46 -05:00
parent 994e94a569
commit 93447f0b5e
3 changed files with 14 additions and 14 deletions
+5 -5
View File
@@ -346,7 +346,7 @@ Variants {
} }
onPositionChanged: mouse => { onPositionChanged: mouse => {
if (!(mouse.buttons & Qt.LeftButton) || card.isRemoving) if (!(mouse.buttons & Qt.LeftButton) || card.isRemoving)
return; return;
const globalPoint = cardDragArea.mapToGlobal(mouse.x, mouse.y); const globalPoint = cardDragArea.mapToGlobal(mouse.x, mouse.y);
const rawDeltaX = globalPoint.x - card.pressGlobalX; const rawDeltaX = globalPoint.x - card.pressGlobalX;
const rawDeltaY = globalPoint.y - card.pressGlobalY; const rawDeltaY = globalPoint.y - card.pressGlobalY;
@@ -355,11 +355,11 @@ Variants {
if (!card.isSwiping) { if (!card.isSwiping) {
if (card.useVerticalSwipe) { if (card.useVerticalSwipe) {
if (Math.abs(deltaY) < card.swipeStartThreshold) if (Math.abs(deltaY) < card.swipeStartThreshold)
return; return;
card.isSwiping = true; card.isSwiping = true;
} else { } else {
if (Math.abs(deltaX) < card.swipeStartThreshold) if (Math.abs(deltaX) < card.swipeStartThreshold)
return; return;
card.isSwiping = true; card.isSwiping = true;
} }
} }
@@ -378,7 +378,7 @@ Variants {
} }
if (mouse.button !== Qt.LeftButton) if (mouse.button !== Qt.LeftButton)
return; return;
if (card.isSwiping) { if (card.isSwiping) {
const dismissDistance = card.useVerticalSwipe ? Math.abs(card.swipeOffsetY) : Math.abs(card.swipeOffset); const dismissDistance = card.useVerticalSwipe ? Math.abs(card.swipeOffsetY) : Math.abs(card.swipeOffset);
@@ -395,7 +395,7 @@ Variants {
} }
if (card.suppressClick) if (card.suppressClick)
return; return;
var actions = model.actionsJson ? JSON.parse(model.actionsJson) : []; var actions = model.actionsJson ? JSON.parse(model.actionsJson) : [];
var hasDefault = actions.some(function (a) { var hasDefault = actions.some(function (a) {
@@ -439,7 +439,7 @@ SmartPanel {
cursorShape: notificationDelegate.canExpand ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: notificationDelegate.canExpand ? Qt.PointingHandCursor : Qt.ArrowCursor
onPressed: mouse => { onPressed: mouse => {
if (mouse.button !== Qt.LeftButton) if (mouse.button !== Qt.LeftButton)
return; return;
const globalPoint = historyInteractionArea.mapToGlobal(mouse.x, mouse.y); const globalPoint = historyInteractionArea.mapToGlobal(mouse.x, mouse.y);
notificationDelegate.pressGlobalX = globalPoint.x; notificationDelegate.pressGlobalX = globalPoint.x;
notificationDelegate.pressGlobalY = globalPoint.y; notificationDelegate.pressGlobalY = globalPoint.y;
@@ -448,7 +448,7 @@ SmartPanel {
} }
onPositionChanged: mouse => { onPositionChanged: mouse => {
if (!(mouse.buttons & Qt.LeftButton) || notificationDelegate.isRemoving) if (!(mouse.buttons & Qt.LeftButton) || notificationDelegate.isRemoving)
return; return;
const globalPoint = historyInteractionArea.mapToGlobal(mouse.x, mouse.y); const globalPoint = historyInteractionArea.mapToGlobal(mouse.x, mouse.y);
const deltaX = globalPoint.x - notificationDelegate.pressGlobalX; const deltaX = globalPoint.x - notificationDelegate.pressGlobalX;
@@ -456,7 +456,7 @@ SmartPanel {
if (!notificationDelegate.isSwiping) { if (!notificationDelegate.isSwiping) {
if (Math.abs(deltaX) < notificationDelegate.swipeStartThreshold) if (Math.abs(deltaX) < notificationDelegate.swipeStartThreshold)
return; return;
// Only start a swipe-dismiss when horizontal movement is dominant. // Only start a swipe-dismiss when horizontal movement is dominant.
if (Math.abs(deltaX) <= Math.abs(deltaY) * 1.15) { if (Math.abs(deltaX) <= Math.abs(deltaY) * 1.15) {
@@ -470,7 +470,7 @@ SmartPanel {
} }
onReleased: mouse => { onReleased: mouse => {
if (mouse.button !== Qt.LeftButton) if (mouse.button !== Qt.LeftButton)
return; return;
if (notificationDelegate.isSwiping) { if (notificationDelegate.isSwiping) {
if (Math.abs(notificationDelegate.swipeOffset) >= notificationDelegate.swipeDismissThreshold) { if (Math.abs(notificationDelegate.swipeOffset) >= notificationDelegate.swipeDismissThreshold) {
@@ -484,7 +484,7 @@ SmartPanel {
} }
if (!notificationDelegate.canExpand || notificationDelegate.suppressClick) if (!notificationDelegate.canExpand || notificationDelegate.suppressClick)
return; return;
if (scrollView.expandedId === notificationId) { if (scrollView.expandedId === notificationId) {
scrollView.expandedId = ""; scrollView.expandedId = "";
+4 -4
View File
@@ -232,7 +232,7 @@ Item {
} }
onPositionChanged: mouse => { onPositionChanged: mouse => {
if (!(mouse.buttons & Qt.LeftButton)) if (!(mouse.buttons & Qt.LeftButton))
return; return;
const globalPoint = toastDragArea.mapToGlobal(mouse.x, mouse.y); const globalPoint = toastDragArea.mapToGlobal(mouse.x, mouse.y);
const rawDeltaX = globalPoint.x - root.pressGlobalX; const rawDeltaX = globalPoint.x - root.pressGlobalX;
const rawDeltaY = globalPoint.y - root.pressGlobalY; const rawDeltaY = globalPoint.y - root.pressGlobalY;
@@ -241,11 +241,11 @@ Item {
if (!root.isSwiping) { if (!root.isSwiping) {
if (root.useVerticalSwipe) { if (root.useVerticalSwipe) {
if (Math.abs(deltaY) < root.swipeStartThreshold) if (Math.abs(deltaY) < root.swipeStartThreshold)
return; return;
root.isSwiping = true; root.isSwiping = true;
} else { } else {
if (Math.abs(deltaX) < root.swipeStartThreshold) if (Math.abs(deltaX) < root.swipeStartThreshold)
return; return;
root.isSwiping = true; root.isSwiping = true;
} }
} }
@@ -259,7 +259,7 @@ Item {
} }
onReleased: mouse => { onReleased: mouse => {
if (mouse.button !== Qt.LeftButton) if (mouse.button !== Qt.LeftButton)
return; return;
if (root.isSwiping) { if (root.isSwiping) {
root.isSwiping = false; root.isSwiping = false;
const dismissDistance = root.useVerticalSwipe ? Math.abs(root.swipeOffsetY) : Math.abs(root.swipeOffset); const dismissDistance = root.useVerticalSwipe ? Math.abs(root.swipeOffsetY) : Math.abs(root.swipeOffset);