mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-08 14:38:30 -04:00
dash/weather: fix X wheel scroll
port 1.5
This commit is contained in:
@@ -936,7 +936,7 @@ Item {
|
|||||||
id: dailyLoader
|
id: dailyLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: dailyComponent
|
sourceComponent: dailyComponent
|
||||||
active: root.visible && root.available
|
active: root.visible && root.available && width > 0 && height > 0
|
||||||
visible: !root.showHourly
|
visible: !root.showHourly
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
opacity: 0
|
opacity: 0
|
||||||
@@ -953,7 +953,7 @@ Item {
|
|||||||
id: hourlyLoader
|
id: hourlyLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: hourlyComponent
|
sourceComponent: hourlyComponent
|
||||||
active: root.visible && root.available
|
active: root.visible && root.available && width > 0 && height > 0
|
||||||
visible: root.showHourly
|
visible: root.showHourly
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
opacity: 0
|
opacity: 0
|
||||||
@@ -1038,6 +1038,7 @@ Item {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
property real hWheelAccum: 0
|
||||||
onWheel: wheel => {
|
onWheel: wheel => {
|
||||||
if (wheel.modifiers & Qt.ShiftModifier) {
|
if (wheel.modifiers & Qt.ShiftModifier) {
|
||||||
if (wheel.angleDelta.y % 120 == 0 && wheel.angleDelta.x == 0) {
|
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;
|
wheel.accepted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1096,6 +1106,7 @@ Item {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
property real hWheelAccum: 0
|
||||||
onWheel: wheel => {
|
onWheel: wheel => {
|
||||||
if (wheel.modifiers & Qt.ShiftModifier) {
|
if (wheel.modifiers & Qt.ShiftModifier) {
|
||||||
if (wheel.angleDelta.y % 120 == 0 && wheel.angleDelta.x == 0) {
|
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;
|
wheel.accepted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user