Disable map zoom when middle button is pressed

This commit is contained in:
Marcus Huderle 2020-06-27 17:07:23 -05:00
parent c1ed591125
commit 370221a974
2 changed files with 9 additions and 1 deletions

View file

@ -108,6 +108,7 @@ public:
public slots:
void scaleMapView(int);
void onWheelZoom(int);
private slots:
void on_action_Open_Project_triggered();

View file

@ -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
{