mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:18:11 +00:00
PixelPaint: Ensure a layer is selected when restoring a snapshot
Previously when restoring the starting snapshot in the UndoStack we would end up with no layer selected, which was kinda annoying
This commit is contained in:
parent
6108bac606
commit
c7431da3f2
1 changed files with 8 additions and 1 deletions
|
@ -259,14 +259,21 @@ void Image::restore_snapshot(Image const& snapshot)
|
|||
{
|
||||
m_layers.clear();
|
||||
select_layer(nullptr);
|
||||
|
||||
bool layer_selected = false;
|
||||
for (const auto& snapshot_layer : snapshot.m_layers) {
|
||||
auto layer = Layer::try_create_snapshot(*this, snapshot_layer);
|
||||
VERIFY(layer);
|
||||
if (layer->is_selected())
|
||||
if (layer->is_selected()) {
|
||||
select_layer(layer.ptr());
|
||||
layer_selected = true;
|
||||
}
|
||||
add_layer(*layer);
|
||||
}
|
||||
|
||||
if (!layer_selected)
|
||||
select_layer(&layer(0));
|
||||
|
||||
did_modify_layer_stack();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue