Fix bug where right-click selecting from the map would cause a map commit
This commit is contained in:
parent
6b5ad53733
commit
95bb802ad0
2 changed files with 25 additions and 23 deletions
47
editor.cpp
47
editor.cpp
|
@ -1072,19 +1072,19 @@ void ConnectionPixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) {
|
||||||
|
|
||||||
void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
|
void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
|
||||||
if (map) {
|
if (map) {
|
||||||
QPointF pos = event->pos();
|
|
||||||
int x = (int)(pos.x()) / 16;
|
|
||||||
int y = (int)(pos.y()) / 16;
|
|
||||||
|
|
||||||
// Paint onto the map.
|
|
||||||
if (map->smart_paths_enabled && map->selected_metatiles_width == 3 && map->selected_metatiles_height == 3) {
|
|
||||||
paintSmartPath(x, y);
|
|
||||||
} else {
|
|
||||||
paintNormal(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
|
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
|
||||||
map->commit();
|
map->commit();
|
||||||
|
} else {
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
int x = (int)(pos.x()) / 16;
|
||||||
|
int y = (int)(pos.y()) / 16;
|
||||||
|
|
||||||
|
// Paint onto the map.
|
||||||
|
if (map->smart_paths_enabled && map->selected_metatiles_width == 3 && map->selected_metatiles_height == 3) {
|
||||||
|
paintSmartPath(x, y);
|
||||||
|
} else {
|
||||||
|
paintNormal(x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
@ -1251,21 +1251,22 @@ void MapPixmapItem::updateMetatileSelection(QGraphicsSceneMouseEvent *event) {
|
||||||
|
|
||||||
void MapPixmapItem::floodFill(QGraphicsSceneMouseEvent *event) {
|
void MapPixmapItem::floodFill(QGraphicsSceneMouseEvent *event) {
|
||||||
if (map) {
|
if (map) {
|
||||||
QPointF pos = event->pos();
|
|
||||||
int x = (int)(pos.x()) / 16;
|
|
||||||
int y = (int)(pos.y()) / 16;
|
|
||||||
Block *block = map->getBlock(x, y);
|
|
||||||
int tile = map->selected_metatiles->first();
|
|
||||||
if (block && block->tile != tile) {
|
|
||||||
if (map->smart_paths_enabled && map->selected_metatiles_width == 3 && map->selected_metatiles_height == 3)
|
|
||||||
this->_floodFillSmartPath(x, y);
|
|
||||||
else
|
|
||||||
this->_floodFill(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
|
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
|
||||||
map->commit();
|
map->commit();
|
||||||
|
} else {
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
int x = (int)(pos.x()) / 16;
|
||||||
|
int y = (int)(pos.y()) / 16;
|
||||||
|
Block *block = map->getBlock(x, y);
|
||||||
|
int tile = map->selected_metatiles->first();
|
||||||
|
if (block && block->tile != tile) {
|
||||||
|
if (map->smart_paths_enabled && map->selected_metatiles_width == 3 && map->selected_metatiles_height == 3)
|
||||||
|
this->_floodFillSmartPath(x, y);
|
||||||
|
else
|
||||||
|
this->_floodFill(x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
connect(editor, SIGNAL(loadMapRequested(QString, QString)), this, SLOT(onLoadMapRequested(QString, QString)));
|
connect(editor, SIGNAL(loadMapRequested(QString, QString)), this, SLOT(onLoadMapRequested(QString, QString)));
|
||||||
connect(editor, SIGNAL(tilesetChanged(QString)), this, SLOT(onTilesetChanged(QString)));
|
connect(editor, SIGNAL(tilesetChanged(QString)), this, SLOT(onTilesetChanged(QString)));
|
||||||
connect(editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
|
connect(editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
|
||||||
|
connect(editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged()));
|
||||||
|
|
||||||
on_toolButton_Paint_clicked();
|
on_toolButton_Paint_clicked();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue