Fix reintroduction of issue fixed by 79e384ef76
This commit is contained in:
parent
6251da65b2
commit
bc788b6caa
1 changed files with 23 additions and 8 deletions
|
@ -66,8 +66,14 @@ void MetatileSelector::setTilesets(Tileset *primaryTileset, Tileset *secondaryTi
|
||||||
this->primaryTileset = primaryTileset;
|
this->primaryTileset = primaryTileset;
|
||||||
this->secondaryTileset = secondaryTileset;
|
this->secondaryTileset = secondaryTileset;
|
||||||
if (!this->selectionIsValid()) {
|
if (!this->selectionIsValid()) {
|
||||||
this->select(Project::getNumMetatilesPrimary() + this->secondaryTileset->metatiles->length() - 1);
|
if (this->externalSelection) {
|
||||||
} else if (!this->externalSelection) {
|
this->select(0);
|
||||||
|
} else {
|
||||||
|
this->select(Project::getNumMetatilesPrimary() + this->secondaryTileset->metatiles->length() - 1);
|
||||||
|
}
|
||||||
|
} else if (this->externalSelection) {
|
||||||
|
emit selectedMetatilesChanged();
|
||||||
|
} else {
|
||||||
updateSelectedMetatiles();
|
updateSelectedMetatiles();
|
||||||
}
|
}
|
||||||
this->draw();
|
this->draw();
|
||||||
|
@ -153,15 +159,24 @@ void MetatileSelector::updateSelectedMetatiles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MetatileSelector::selectionIsValid() {
|
bool MetatileSelector::selectionIsValid() {
|
||||||
QPoint origin = this->getSelectionStart();
|
if (this->externalSelection) {
|
||||||
QPoint dimensions = this->getSelectionDimensions();
|
for (int i = 0; i < this->externalSelectedMetatiles->count(); ++i) {
|
||||||
for (int j = 0; j < dimensions.y(); j++) {
|
int tileId = this->externalSelectedMetatiles->at(i);
|
||||||
for (int i = 0; i < dimensions.x(); i++) {
|
if (!Tileset::metatileIsValid(tileId, this->primaryTileset, this->secondaryTileset))
|
||||||
if (!Tileset::metatileIsValid(this->getMetatileId(origin.x() + i, origin.y() + j), this->primaryTileset, this->secondaryTileset))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
QPoint origin = this->getSelectionStart();
|
||||||
|
QPoint dimensions = this->getSelectionDimensions();
|
||||||
|
for (int j = 0; j < dimensions.y(); j++) {
|
||||||
|
for (int i = 0; i < dimensions.x(); i++) {
|
||||||
|
if (!Tileset::metatileIsValid(this->getMetatileId(origin.x() + i, origin.y() + j), this->primaryTileset, this->secondaryTileset))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t MetatileSelector::getMetatileId(int x, int y) {
|
uint16_t MetatileSelector::getMetatileId(int x, int y) {
|
||||||
|
|
Loading…
Reference in a new issue