LibreVNA-GUI:Traces:tracepolot: Fix getting QWheelEvent position
This commit is contained in:
parent
3f39a736e0
commit
84953d23d1
@ -413,11 +413,12 @@ void TracePlot::leaveEvent(QEvent *event)
|
||||
void TracePlot::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
auto &pref = Preferences::getInstance();
|
||||
if(pref.Graphs.enablePanAndZoom && positionWithinGraphArea(event->pos())) {
|
||||
QPoint position(event->position().x(), event->position().y());
|
||||
if(pref.Graphs.enablePanAndZoom && positionWithinGraphArea(position)) {
|
||||
bool horizontally = !(QApplication::keyboardModifiers() & Qt::ShiftModifier);
|
||||
bool vertically = !(QApplication::keyboardModifiers() & Qt::ControlModifier);
|
||||
double factor = pow(pref.Graphs.zoomFactor, (double) event->angleDelta().y() / 120.0);
|
||||
zoom(event->pos(), factor, horizontally, vertically);
|
||||
zoom(position, factor, horizontally, vertically);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user