From c4cdc47e20568b76c9428d315a3fa07b59a5f13b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 6 Jul 2020 13:36:59 -0400 Subject: [PATCH] Fix tileset editor syncing selection on save --- include/mainwindow.h | 1 + src/mainwindow.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/mainwindow.h b/include/mainwindow.h index 6f478c0f..79a504e4 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -310,6 +310,7 @@ private: bool isProjectOpen(); void showExportMapImageWindow(bool stitchMode); + void redrawMetatileSelection(); }; enum MapListUserRoles { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 602736a8..d678033a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1145,7 +1145,7 @@ void MainWindow::updateTilesetEditor() { } } -void MainWindow::currentMetatilesSelectionChanged() +void MainWindow::redrawMetatileSelection() { double scale = pow(3.0, static_cast(porymapConfig.getMetatilesZoom() - 30) / 30.0); ui->graphicsView_currentMetatileSelection->setFixedSize(editor->scene_current_metatile_selection_item->pixmap().width() * scale + 2, editor->scene_current_metatile_selection_item->pixmap().height() * scale + 2); @@ -1157,6 +1157,11 @@ void MainWindow::currentMetatilesSelectionChanged() pos *= scale; ui->scrollArea_2->ensureVisible(pos.x(), pos.y(), 8 * scale, 8 * scale); } +} + +void MainWindow::currentMetatilesSelectionChanged() +{ + redrawMetatileSelection(); if (this->tilesetEditor) this->tilesetEditor->selectMetatile(editor->metatile_selector_item->getSelectedMetatiles()->at(0)); } @@ -2583,7 +2588,7 @@ void MainWindow::on_horizontalSlider_MetatileZoom_valueChanged(int value) { ceil(static_cast(editor->selected_border_metatiles_item->pixmap().height()) * scale) + 2); ui->graphicsView_currentMetatileSelection->setMatrix(matrix); - currentMetatilesSelectionChanged(); + redrawMetatileSelection(); } void MainWindow::on_actionRegion_Map_Editor_triggered() {