Fix bug where right-click selecting from the map would cause a map commit

This commit is contained in:
Marcus Huderle 2018-07-19 22:49:27 -05:00
parent 6b5ad53733
commit 95bb802ad0
2 changed files with 25 additions and 23 deletions

View file

@ -1072,6 +1072,9 @@ void ConnectionPixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) {
void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
if (map) {
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
map->commit();
} else {
QPointF pos = event->pos();
int x = (int)(pos.x()) / 16;
int y = (int)(pos.y()) / 16;
@ -1082,9 +1085,6 @@ void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
} else {
paintNormal(x, y);
}
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
map->commit();
}
draw();
@ -1251,6 +1251,9 @@ void MapPixmapItem::updateMetatileSelection(QGraphicsSceneMouseEvent *event) {
void MapPixmapItem::floodFill(QGraphicsSceneMouseEvent *event) {
if (map) {
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
map->commit();
} else {
QPointF pos = event->pos();
int x = (int)(pos.x()) / 16;
int y = (int)(pos.y()) / 16;
@ -1262,10 +1265,8 @@ void MapPixmapItem::floodFill(QGraphicsSceneMouseEvent *event) {
else
this->_floodFill(x, y);
}
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
map->commit();
}
draw();
}
}

View file

@ -38,6 +38,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(editor, SIGNAL(loadMapRequested(QString, QString)), this, SLOT(onLoadMapRequested(QString, QString)));
connect(editor, SIGNAL(tilesetChanged(QString)), this, SLOT(onTilesetChanged(QString)));
connect(editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
connect(editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged()));
on_toolButton_Paint_clicked();