diff --git a/editor.cpp b/editor.cpp index 31a03dc2..962907d9 100755 --- a/editor.cpp +++ b/editor.cpp @@ -1072,19 +1072,19 @@ void ConnectionPixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) { void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) { 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) { 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(); @@ -1251,21 +1251,22 @@ void MapPixmapItem::updateMetatileSelection(QGraphicsSceneMouseEvent *event) { void MapPixmapItem::floodFill(QGraphicsSceneMouseEvent *event) { 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) { 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(); } } diff --git a/mainwindow.cpp b/mainwindow.cpp index d518ae9d..b9979dc3 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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();