From e4067bf08841abce09ae69066aa37acf6e6281d6 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 21 May 2025 22:57:33 -0400 Subject: [PATCH] Allow right-clicking border metatiles to select them --- CHANGELOG.md | 1 + src/ui/bordermetatilespixmapitem.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cbe7dd9..34388d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp - The max encounter rate is now read from the project, rather than assuming the default value from RSE. - `MAP_OFFSET_W` and `MAP_OFFSET_H` (used to limit the maximum map size) are now read from the project. - The rendered area of the map border is now limited to the maximum player view distance (prior to this it included two extra rows on the top and bottom). +- Right-clicking on the border metatiles image will now select that metatile. - An error message will now be shown when Porymap is unable to save changes (e.g. if Porymap doesn't have write permissions for your project). - Error and warning logs are now displayed in the status bar. This can be changed with a new setting. - A project may now be opened even if it has no maps or map groups. A minimum of one map layout is required. diff --git a/src/ui/bordermetatilespixmapitem.cpp b/src/ui/bordermetatilespixmapitem.cpp index 6c542558..e793e466 100644 --- a/src/ui/bordermetatilespixmapitem.cpp +++ b/src/ui/bordermetatilespixmapitem.cpp @@ -5,8 +5,16 @@ #include void BorderMetatilesPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { - MetatileSelection selection = this->metatileSelector->getMetatileSelection(); QPoint pos = Metatile::coordFromPixmapCoord(event->pos()); + if (event->buttons() & Qt::RightButton) { + // Selecting metatiles + this->metatileSelector->select(this->layout->getBorderMetatileId(pos.x(), pos.y())); + return; + } + + // Painting metatiles + MetatileSelection selection = this->metatileSelector->getMetatileSelection(); + int width = layout->getBorderWidth(); int height = layout->getBorderHeight();