mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-18 17:24:01 -04:00
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user