Fix bug where dragging the metatile selector would visually extend beyond map boundary
This commit is contained in:
parent
33a2cfe06a
commit
5978aedc30
2 changed files with 4 additions and 3 deletions
|
@ -100,6 +100,8 @@ void CursorTileRect::updateLocation(int coordX, int coordY)
|
|||
}
|
||||
}
|
||||
|
||||
coordX = qMax(coordX, 0);
|
||||
coordY = qMax(coordY, 0);
|
||||
this->setX(coordX * 16);
|
||||
this->setY(coordY * 16);
|
||||
this->setVisible(*this->enabled && this->visible);
|
||||
|
|
|
@ -226,11 +226,10 @@ void MapPixmapItem::updateMetatileSelection(QGraphicsSceneMouseEvent *event) {
|
|||
Block *block = map->getBlock(x, y);
|
||||
this->metatileSelector->selectFromMap(block->tile, block->collision, block->elevation);
|
||||
} else if (event->type() == QEvent::GraphicsSceneMouseMove) {
|
||||
QPoint pos = QPoint(x, y);
|
||||
int x1 = selection_origin.x();
|
||||
int y1 = selection_origin.y();
|
||||
int x2 = pos.x();
|
||||
int y2 = pos.y();
|
||||
int x2 = x;
|
||||
int y2 = y;
|
||||
if (x1 > x2) SWAP(x1, x2);
|
||||
if (y1 > y2) SWAP(y1, y2);
|
||||
selection.clear();
|
||||
|
|
Loading…
Reference in a new issue