Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
EdnY1 authored and tishion committed Sep 21, 2024
1 parent 4326aef commit bfa6641
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/details/QCefViewPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,19 +1036,18 @@ QCefViewPrivate::onViewWheelEvent(QWheelEvent* event)
e.modifiers |= m & Qt::ControlModifier ? EVENTFLAG_CONTROL_DOWN : 0;
e.modifiers |= m & Qt::ShiftModifier ? EVENTFLAG_SHIFT_DOWN : 0;
e.modifiers |= m & Qt::AltModifier ? EVENTFLAG_ALT_DOWN : 0;
e.modifiers |= b & Qt::LeftButton ? EVENTFLAG_LEFT_MOUSE_BUTTON : 0;
e.modifiers |= b & Qt::RightButton ? EVENTFLAG_RIGHT_MOUSE_BUTTON : 0;
e.modifiers |= b & Qt::MiddleButton ? EVENTFLAG_MIDDLE_MOUSE_BUTTON : 0;

e.x = p.x();
e.y = p.y();

// Prevent diagonal scrolling: only allow scrolling in one direction at a time
if (d.x() != 0 && d.y() != 0) {
if (std::abs(d.x()) > std::abs(d.y())) {
d.setY(0);
} else {
d.setX(0);
}
if (qAbs(d.x()) > qAbs(d.y())) {
d.setY(0);
} else {
d.setX(0);
}

pCefBrowser_->GetHost()->SendMouseWheelEvent(e, d.x(), d.y());
Expand Down

0 comments on commit bfa6641

Please sign in to comment.