1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 06:22:50 -05:00

dankbar: copy high-dpi scrolling logic from DankListView

This commit is contained in:
bbedward
2025-12-29 10:52:33 -05:00
parent 518a5d38aa
commit 60034be06a
2 changed files with 25 additions and 15 deletions

View File

@@ -674,23 +674,27 @@ Item {
return;
const delta = wheel.angleDelta.y;
const isMouseWheel = Math.abs(delta) >= 120 && (Math.abs(delta) % 120) === 0;
const hasPixel = wheel.pixelDelta && wheel.pixelDelta.y !== 0;
const isTraditionalMouse = !hasPixel && Math.abs(delta) >= 120 && (Math.abs(delta) % 120) === 0;
const isHighDpiMouse = !hasPixel && !isTraditionalMouse && delta !== 0;
const reverse = SettingsData.reverseScrolling ? -1 : 1;
const direction = delta * reverse < 0 ? 1 : -1;
if (isMouseWheel) {
if (isTraditionalMouse || isHighDpiMouse) {
root.switchWorkspace(direction);
scrollInProgress = true;
scrollCooldown.restart();
} else {
scrollAccumulator += delta;
if (Math.abs(scrollAccumulator) >= touchpadThreshold) {
const touchDirection = scrollAccumulator < 0 ? 1 : -1;
root.switchWorkspace(touchDirection);
scrollInProgress = true;
scrollCooldown.restart();
scrollAccumulator = 0;
}
scrollAccumulator = 0;
return;
}
scrollAccumulator += delta;
if (Math.abs(scrollAccumulator) >= touchpadThreshold) {
const touchDirection = scrollAccumulator < 0 ? 1 : -1;
root.switchWorkspace(touchDirection);
scrollInProgress = true;
scrollCooldown.restart();
scrollAccumulator = 0;
}
}
}