mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 17:47:09 +00:00
22 lines
537 B
QML
22 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;
|
|
}
|
|
}
|
|
}
|