Skip to content

Commit

Permalink
Tweaked setting the current object when switching layers
Browse files Browse the repository at this point in the history
When there is no current object, it's better to set it to the new layer.
This makes sure the next layer properties are displayed when for example
deleting a layer.
  • Loading branch information
bjorn committed Mar 7, 2017
1 parent 388bd94 commit 2ea0b28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tiled/mapdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ void MapDocument::setCurrentLayer(Layer *layer)
mCurrentLayer = layer;
emit currentLayerChanged(mCurrentLayer);

if (mCurrentLayer && mCurrentObject)
if (mCurrentObject->typeId() == Object::LayerType)
if (mCurrentLayer)
if (!mCurrentObject || mCurrentObject->typeId() == Object::LayerType)
setCurrentObject(mCurrentLayer);
}

Expand Down

0 comments on commit 2ea0b28

Please sign in to comment.