Fix 1x1 layer tile selection not highlighting
This commit is contained in:
parent
acc6da4c58
commit
3312280287
3 changed files with 13 additions and 4 deletions
|
@ -21,6 +21,7 @@ public:
|
|||
QPoint getSelectionDimensions();
|
||||
void draw();
|
||||
void select(uint16_t metatileId);
|
||||
void highlight(uint16_t metatileId);
|
||||
void setTilesets(Tileset*, Tileset*);
|
||||
void setPaletteId(int);
|
||||
void setTileFlips(bool, bool);
|
||||
|
|
|
@ -343,8 +343,12 @@ void TilesetEditor::onMetatileLayerSelectionChanged(QPoint selectionOrigin, int
|
|||
}
|
||||
}
|
||||
|
||||
if (width == 1 && height == 1)
|
||||
if (width == 1 && height == 1) {
|
||||
this->tileSelector->highlight(static_cast<uint16_t>(tiles[0].tile));
|
||||
ui->spinBox_paletteSelector->setValue(tiles[0].palette);
|
||||
QPoint pos = tileSelector->getTileCoordsOnWidget(static_cast<uint16_t>(tiles[0].tile));
|
||||
ui->scrollArea_Tiles->ensureVisible(pos.x(), pos.y());
|
||||
}
|
||||
this->tileSelector->setExternalSelection(width, height, tiles, tileIdxs);
|
||||
this->metatileLayersItem->clearLastModifiedCoords();
|
||||
}
|
||||
|
|
|
@ -50,19 +50,23 @@ void TilesetEditorTileSelector::draw() {
|
|||
painter.end();
|
||||
this->setPixmap(QPixmap::fromImage(image));
|
||||
|
||||
if (!this->externalSelection) {
|
||||
if (!this->externalSelection || (this->externalSelectionWidth == 1 && this->externalSelectionHeight == 1)) {
|
||||
this->drawSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void TilesetEditorTileSelector::select(uint16_t tile) {
|
||||
this->externalSelection = false;
|
||||
QPoint coords = this->getTileCoords(tile);
|
||||
SelectablePixmapItem::select(coords.x(), coords.y(), 0, 0);
|
||||
this->highlight(tile);
|
||||
this->updateSelectedTiles();
|
||||
emit selectedTilesChanged();
|
||||
}
|
||||
|
||||
void TilesetEditorTileSelector::highlight(uint16_t tile) {
|
||||
QPoint coords = this->getTileCoords(tile);
|
||||
SelectablePixmapItem::select(coords.x(), coords.y(), 0, 0);
|
||||
}
|
||||
|
||||
void TilesetEditorTileSelector::setTilesets(Tileset *primaryTileset, Tileset *secondaryTileset) {
|
||||
this->primaryTileset = primaryTileset;
|
||||
this->secondaryTileset = secondaryTileset;
|
||||
|
|
Loading…
Reference in a new issue