mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
added photo switch by scroll gestures for os x in mediaview
This commit is contained in:
@@ -1194,6 +1194,23 @@ bool MediaView::event(QEvent *e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (e->type() == QEvent::Wheel) {
|
||||
QWheelEvent *ev = static_cast<QWheelEvent*>(e);
|
||||
if (ev->phase() == Qt::ScrollBegin) {
|
||||
_accumScroll = ev->angleDelta();
|
||||
LOG(("Scrolling begin: %1 sum %2").arg(ev->angleDelta().x()).arg(_accumScroll.x()));
|
||||
} else {
|
||||
_accumScroll += ev->angleDelta();
|
||||
if (ev->phase() == Qt::ScrollEnd) {
|
||||
LOG(("Scrolling end: %1 sum %2").arg(ev->angleDelta().x()).arg(_accumScroll.x()));
|
||||
if (ev->orientation() == Qt::Horizontal) {
|
||||
if (_accumScroll.x() * _accumScroll.x() > _accumScroll.y() * _accumScroll.y() && _accumScroll.x() != 0) {
|
||||
moveToPhoto(_accumScroll.x() > 0 ? -1 : 1);
|
||||
}
|
||||
_accumScroll = QPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QWidget::event(e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user