diff --git a/quickshell/Modules/DBar/Popouts/BatteryHistoryChart.qml b/quickshell/Modules/DBar/Popouts/BatteryHistoryChart.qml index ed7afa7f9..8278cf944 100644 --- a/quickshell/Modules/DBar/Popouts/BatteryHistoryChart.qml +++ b/quickshell/Modules/DBar/Popouts/BatteryHistoryChart.qml @@ -294,13 +294,15 @@ DCard { acceptedButtons: Qt.NoButton hoverEnabled: true onWheel: wheel => { - if (wheel.angleDelta.x === 0 && wheel.pixelDelta.x === 0 && !(wheel.modifiers & Qt.ShiftModifier)) { + const horizontal = wheel.angleDelta.x !== 0 || wheel.pixelDelta.x !== 0 || (wheel.modifiers & Qt.ShiftModifier); + if (!horizontal || !root.scrollable) { wheel.accepted = false; return; } const pixels = WheelInput.isTouchpad(wheel) ? wheel.pixelDelta.x || wheel.pixelDelta.y : 0; const steps = (wheel.angleDelta.x || wheel.angleDelta.y) / 120; - wheel.accepted = root.scrollTo(timeline.contentX - (pixels || steps * timeline.mouseWheelSpeed)); + root.scrollTo(timeline.contentX - (pixels || steps * timeline.mouseWheelSpeed)); + wheel.accepted = true; } } diff --git a/quickshell/Modules/DDash/Weather/WeatherForecastChart.qml b/quickshell/Modules/DDash/Weather/WeatherForecastChart.qml index 621efdfdc..821a8180e 100644 --- a/quickshell/Modules/DDash/Weather/WeatherForecastChart.qml +++ b/quickshell/Modules/DDash/Weather/WeatherForecastChart.qml @@ -60,15 +60,17 @@ Item { anchors.fill: parent acceptedButtons: Qt.NoButton onWheel: wheel => { - const delta = wheel.angleDelta.x || wheel.angleDelta.y; - if (wheel.angleDelta.x === 0 && !(wheel.modifiers & Qt.ShiftModifier)) { + const horizontal = wheel.angleDelta.x !== 0 || (wheel.modifiers & Qt.ShiftModifier); + if (!horizontal || root.maxStart === 0) { wheel.accepted = false; return; } + const delta = wheel.angleDelta.x || wheel.angleDelta.y; const step = delta > 0 ? -1 : 1; - wheel.accepted = delta !== 0 && root.start + step >= 0 && root.start + step <= root.maxStart; - if (wheel.accepted) + const next = root.start + step; + if (delta !== 0 && next >= 0 && next <= root.maxStart) root.pageRequested(step); + wheel.accepted = true; } }