charts: swallow shift+wheel at the scroll bounds

fixes #3736
This commit is contained in:
bbedward
2026-10-09 12:22:53 -04:00
parent c417cd10ea
commit a0ea04178f
2 changed files with 10 additions and 6 deletions
@@ -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;
}
}