nosignal-shell/widgets/CustomMouseArea.qml
2 * r + 2 * t 2c9feb7544 internal: fix scrolling for high res devices
Implements first part of #202
2025-07-09 23:53:01 +10:00

21 lines
537 B
QML

import QtQuick
MouseArea {
property int scrollAccumulatedY: 0
function onWheel(event: WheelEvent): void {
}
onWheel: event => {
// Update accumulated scroll
if (Math.sign(event.angleDelta.y) !== Math.sign(scrollAccumulatedY))
scrollAccumulatedY = 0;
scrollAccumulatedY += event.angleDelta.y;
// Trigger handler and reset if above threshold
if (Math.abs(scrollAccumulatedY) >= 120) {
onWheel(event);
scrollAccumulatedY = 0;
}
}
}