mirror of
https://github.com/YACReader/yacreader
synced 2025-05-27 10:50:27 -04:00
Use angleDelta
pixelDelta is only provided in systems that support it
This commit is contained in:
parent
052e7ffba0
commit
ae43f23c85
@ -195,7 +195,7 @@ void GoToFlow::updateImageData()
|
||||
|
||||
void GoToFlow::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (event->pixelDelta().y() < 0)
|
||||
if (event->angleDelta().y() < 0)
|
||||
flow->showNext();
|
||||
else
|
||||
flow->showPrevious();
|
||||
|
@ -144,28 +144,28 @@ void MagnifyingGlass::wheelEvent(QWheelEvent *event)
|
||||
switch (event->modifiers()) {
|
||||
// size
|
||||
case Qt::NoModifier:
|
||||
if (event->pixelDelta().y() < 0)
|
||||
if (event->angleDelta().y() < 0)
|
||||
sizeUp();
|
||||
else
|
||||
sizeDown();
|
||||
break;
|
||||
// size height
|
||||
case Qt::ControlModifier:
|
||||
if (event->pixelDelta().y() < 0)
|
||||
if (event->angleDelta().y() < 0)
|
||||
heightUp();
|
||||
else
|
||||
heightDown();
|
||||
break;
|
||||
// size width
|
||||
case Qt::AltModifier:
|
||||
if (event->pixelDelta().y() < 0)
|
||||
if (event->angleDelta().y() < 0)
|
||||
widthUp();
|
||||
else
|
||||
widthDown();
|
||||
break;
|
||||
// zoom level
|
||||
case Qt::ShiftModifier:
|
||||
if (event->pixelDelta().y() < 0)
|
||||
if (event->angleDelta().y() < 0)
|
||||
zoomIn();
|
||||
else
|
||||
zoomOut();
|
||||
|
@ -688,13 +688,15 @@ static void animateScroll(QPropertyAnimation &scroller, const QScrollBar &scroll
|
||||
|
||||
void Viewer::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
auto delta = event->angleDelta();
|
||||
|
||||
if (render->hasLoadedComic()) {
|
||||
if (event->pixelDelta().x() != 0) {
|
||||
animateScroll(*horizontalScroller, *horizontalScrollBar(), event->pixelDelta().x());
|
||||
if (delta.x() != 0) {
|
||||
animateScroll(*horizontalScroller, *horizontalScrollBar(), delta.x());
|
||||
return;
|
||||
}
|
||||
|
||||
if ((event->pixelDelta().y() < 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum())) {
|
||||
if ((delta.y() < 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum())) {
|
||||
if (wheelStop || verticalScrollBar()->maximum() == verticalScrollBar()->minimum()) {
|
||||
if (getMovement(event) == Forward) {
|
||||
next();
|
||||
@ -706,7 +708,7 @@ void Viewer::wheelEvent(QWheelEvent *event)
|
||||
} else
|
||||
wheelStop = true;
|
||||
} else {
|
||||
if ((event->pixelDelta().y() > 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum())) {
|
||||
if ((delta.y() > 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum())) {
|
||||
if (wheelStop || verticalScrollBar()->maximum() == verticalScrollBar()->minimum()) {
|
||||
if (getMovement(event) == Backward) {
|
||||
prev();
|
||||
@ -720,7 +722,7 @@ void Viewer::wheelEvent(QWheelEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
animateScroll(*verticalScroller, *verticalScrollBar(), event->pixelDelta().y());
|
||||
animateScroll(*verticalScroller, *verticalScrollBar(), delta.y());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user