mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
dash/weather: fix X wheel scroll
port 1.5
(cherry picked from commit 5589cfb783)
This commit is contained in:
@@ -936,7 +936,7 @@ Item {
|
||||
id: dailyLoader
|
||||
anchors.fill: parent
|
||||
sourceComponent: dailyComponent
|
||||
active: root.visible && root.available
|
||||
active: root.visible && root.available && width > 0 && height > 0
|
||||
visible: !root.showHourly
|
||||
asynchronous: true
|
||||
opacity: 0
|
||||
@@ -953,7 +953,7 @@ Item {
|
||||
id: hourlyLoader
|
||||
anchors.fill: parent
|
||||
sourceComponent: hourlyComponent
|
||||
active: root.visible && root.available
|
||||
active: root.visible && root.available && width > 0 && height > 0
|
||||
visible: root.showHourly
|
||||
asynchronous: true
|
||||
opacity: 0
|
||||
@@ -1038,6 +1038,7 @@ Item {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
property real hWheelAccum: 0
|
||||
onWheel: wheel => {
|
||||
if (wheel.modifiers & Qt.ShiftModifier) {
|
||||
if (wheel.angleDelta.y % 120 == 0 && wheel.angleDelta.x == 0) {
|
||||
@@ -1049,6 +1050,15 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wheel.angleDelta.x !== 0) {
|
||||
hWheelAccum += wheel.angleDelta.x;
|
||||
const steps = Math.trunc(hWheelAccum / 120);
|
||||
hWheelAccum -= steps * 120;
|
||||
if (steps !== 0)
|
||||
hourlyList.currentIndex = Math.max(0, Math.min(hourlyList.model - 1, hourlyList.currentIndex - steps));
|
||||
wheel.accepted = true;
|
||||
return;
|
||||
}
|
||||
wheel.accepted = false;
|
||||
}
|
||||
}
|
||||
@@ -1096,6 +1106,7 @@ Item {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
property real hWheelAccum: 0
|
||||
onWheel: wheel => {
|
||||
if (wheel.modifiers & Qt.ShiftModifier) {
|
||||
if (wheel.angleDelta.y % 120 == 0 && wheel.angleDelta.x == 0) {
|
||||
@@ -1107,6 +1118,15 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wheel.angleDelta.x !== 0) {
|
||||
hWheelAccum += wheel.angleDelta.x;
|
||||
const steps = Math.trunc(hWheelAccum / 120);
|
||||
hWheelAccum -= steps * 120;
|
||||
if (steps !== 0)
|
||||
dailyList.currentIndex = Math.max(0, Math.min(dailyList.model - 1, dailyList.currentIndex - steps));
|
||||
wheel.accepted = true;
|
||||
return;
|
||||
}
|
||||
wheel.accepted = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user