Skip to content
Permalink
Browse files

Fixed initialization of selected layers

This caused the Eraser tool to not work until explicitly selecting a
tile layer, because it only modifies the selected layers.

Closes #2719
  • Loading branch information
bjorn committed Dec 30, 2019
1 parent fe71b9c commit 55343278c77f1bf97b9139baaed8098d1e07b6ae
Showing with 6 additions and 2 deletions.
  1. +5 −1 src/tiled/mapdocument.cpp
  2. +1 −1 src/tiled/mapdocument.h
@@ -83,7 +83,11 @@ MapDocument::MapDocument(std::unique_ptr<Map> map)

createRenderer();

mCurrentLayer = (mMap->layerCount() == 0) ? nullptr : mMap->layerAt(0);
if (mMap->layerCount() > 0) {
mCurrentLayer = mMap->layerAt(0);
mSelectedLayers.append(mCurrentLayer);
}

mLayerModel->setMapDocument(this);

// Forward signals emitted from the layer model
@@ -374,7 +374,7 @@ public slots:
QList<MapObject*> mSelectedObjects;
MapObject *mHoveredMapObject; /**< Map object with mouse on top. */
std::unique_ptr<MapRenderer> mRenderer;
Layer *mCurrentLayer;
Layer *mCurrentLayer = nullptr;
MapObjectModel *mMapObjectModel;
bool mAllowHidingObjects = true;
bool mAllowTileObjects = true;

0 comments on commit 5534327

Please sign in to comment.
You can’t perform that action at this time.