Place new events in the center of the map

This commit is contained in:
BigBahss 2021-03-20 11:20:29 -04:00 committed by Tyler Dennis
parent 1c0001504d
commit 5f292ea3cc
3 changed files with 7 additions and 0 deletions

View file

@ -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.

View file

@ -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);

View file

@ -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 {