Skip to content

Commit fe6b62b

Browse files
committed
When adding a new layer, insert it above the current one
It is usually more useful for the layer to be inserted above the current layer, rather than always at the top of the stack.
1 parent f4354fc commit fe6b62b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tiled/mapdocument.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ Layer *MapDocument::addLayer(Layer::TypeFlag layerType)
470470
}
471471
Q_ASSERT(layer);
472472

473-
const int index = mMap->layerCount();
473+
const int index = mCurrentLayerIndex >= 0 ? mCurrentLayerIndex + 1
474+
: mMap->layerCount();
474475
mUndoStack->push(new AddLayer(this, index, layer));
475476
setCurrentLayerIndex(index);
476477

0 commit comments

Comments
 (0)