diff --git a/include/mainwindow.h b/include/mainwindow.h index af9266d1..06bf9853 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -108,6 +108,7 @@ public: public slots: void scaleMapView(int); + void onWheelZoom(int); private slots: void on_action_Open_Project_triggered(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9f698931..22a2b3bd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -115,7 +115,7 @@ void MainWindow::initEditor() { connect(this->editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString))); connect(this->editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged())); connect(this->editor, SIGNAL(wildMonDataChanged()), this, SLOT(onWildMonDataChanged())); - connect(this->editor, &Editor::wheelZoom, this, &MainWindow::scaleMapView); + connect(this->editor, &Editor::wheelZoom, this, &MainWindow::onWheelZoom); this->loadUserSettings(); } @@ -1358,6 +1358,13 @@ void MainWindow::on_actionMap_Shift_triggered() on_toolButton_Shift_clicked(); } +void MainWindow::onWheelZoom(int s) { + // Don't zoom the map when the user accidentally scrolls while performing a magic fill. (ctrl + middle button click) + if (!(QApplication::mouseButtons() & Qt::MiddleButton)) { + scaleMapView(s); + } +} + void MainWindow::scaleMapView(int s) { if ((editor->scale_exp + s) <= 5 && (editor->scale_exp + s) >= -2) // sane limits {