From ad0b8d6794f4bb63e0e01078b21d3b41e957c5cf Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 21 Dec 2024 17:19:31 -0500 Subject: [PATCH] Render metatile/collision views by tab --- CHANGELOG.md | 1 + include/mainwindow.h | 2 ++ src/mainwindow.cpp | 13 +++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b75bed..9c5f4af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - Fix a visual issue when quickly dragging map connections around. - Fix map connections rendering incorrectly if their direction name was unknown. - Fix map connections rendering incorrectly if their dimensions were smaller than the border draw distance. +- Fix metatile/collision selection images skewing off-center after opening a map from the Connections tab. - Fix the map list filter retaining text between project open/close. - Fix the map list mishandling value gaps when sorting by Area. - Fix a freeze on startup if project values are defined with mismatched parentheses. diff --git a/include/mainwindow.h b/include/mainwindow.h index 397a1d72..a4d60697 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -351,6 +351,8 @@ private: bool userSetMap(QString); void redrawMapScene(); void refreshMapScene(); + void refreshMetatileViews(); + void refreshCollisionSelector(); void setLayoutOnlyMode(bool layoutOnly); bool checkProjectSanity(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 12bbdd6f..1608c786 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -948,8 +948,6 @@ void MainWindow::redrawMapScene() { } void MainWindow::refreshMapScene() { - on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex()); - ui->graphicsView_Map->setScene(editor->scene); ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect()); ui->graphicsView_Map->editor = editor; @@ -971,7 +969,14 @@ void MainWindow::refreshMapScene() { //ui->graphicsView_Collision->setSceneRect(editor->scene_collision_metatiles->sceneRect()); ui->graphicsView_Collision->setFixedSize(editor->movement_permissions_selector_item->pixmap().width() + 2, editor->movement_permissions_selector_item->pixmap().height() + 2); + on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex()); +} + +void MainWindow::refreshMetatileViews() { on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value()); +} + +void MainWindow::refreshCollisionSelector() { on_horizontalSlider_CollisionZoom_valueChanged(ui->horizontalSlider_CollisionZoom->value()); } @@ -2126,8 +2131,10 @@ void MainWindow::on_mapViewTab_tabBarClicked(int index) if (index == MapViewTab::Metatiles) { editor->setEditingMetatiles(); + refreshMetatileViews(); } else if (index == MapViewTab::Collision) { editor->setEditingCollision(); + refreshCollisionSelector(); } else if (index == MapViewTab::Prefabs) { editor->setEditingMetatiles(); if (projectConfig.prefabFilepath.isEmpty() && !projectConfig.prefabImportPrompted) { @@ -2939,7 +2946,6 @@ void MainWindow::on_comboBox_PrimaryTileset_currentTextChanged(const QString &ti if (editor->project->primaryTilesetLabels.contains(tilesetLabel) && editor->layout) { editor->updatePrimaryTileset(tilesetLabel); redrawMapScene(); - on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value()); updateTilesetEditor(); prefab.updatePrefabUi(editor->layout); markMapEdited(); @@ -2951,7 +2957,6 @@ void MainWindow::on_comboBox_SecondaryTileset_currentTextChanged(const QString & if (editor->project->secondaryTilesetLabels.contains(tilesetLabel) && editor->layout) { editor->updateSecondaryTileset(tilesetLabel); redrawMapScene(); - on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value()); updateTilesetEditor(); prefab.updatePrefabUi(editor->layout); markMapEdited();