diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e3a054b..3aa0d5ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ The **"Breaking Changes"** listed below are changes that have been made in the d ### Added - Add ability to export map timelapse animated GIFs with `File -> Export Map Timelapse Image...`. +### Changed +- New events will be placed in the center of the current view of the map. + ### Fixed - Fix tileset palette editor crash that could occur when switching maps or tilesets with it open. diff --git a/include/ui/draggablepixmapitem.h b/include/ui/draggablepixmapitem.h index 4bbdf982..e9076c80 100644 --- a/include/ui/draggablepixmapitem.h +++ b/include/ui/draggablepixmapitem.h @@ -34,6 +34,7 @@ public: void updatePosition(); void move(int x, int y); + void move(const QPoint &pos) { move(pos.x(), pos.y()); } void emitPositionChanged(); void updatePixmap(); void bind(QComboBox *combo, QString key); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 843df201..de58cdfe 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1551,6 +1551,9 @@ void MainWindow::addNewEvent(QString event_type) if (editor && editor->project) { DraggablePixmapItem *object = editor->addNewEvent(event_type); if (object) { + auto halfSize = ui->graphicsView_Map->size() / 2; + auto centerPos = ui->graphicsView_Map->mapToScene(halfSize.width(), halfSize.height()); + object->move(Metatile::coordFromPixmapCoord(centerPos)); updateObjects(); editor->selectMapEvent(object, false); } else {