mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
PixelPaint: Make selection changes undoable
Using the Rectangle Select Tool will now generate undo/redo commands like any other tool. :^)
This commit is contained in:
parent
d571159aeb
commit
49deb936be
4 changed files with 12 additions and 0 deletions
|
@ -245,6 +245,7 @@ ErrorOr<NonnullRefPtr<Image>> Image::take_snapshot() const
|
|||
auto layer_snapshot = TRY(Layer::try_create_snapshot(*snapshot, layer));
|
||||
snapshot->add_layer(move(layer_snapshot));
|
||||
}
|
||||
snapshot->m_selection.set_mask(m_selection.mask());
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
|
@ -267,6 +268,9 @@ ErrorOr<void> Image::restore_snapshot(Image const& snapshot)
|
|||
select_layer(&layer(0));
|
||||
|
||||
m_size = snapshot.size();
|
||||
|
||||
m_selection.set_mask(snapshot.m_selection.mask());
|
||||
|
||||
did_change_rect();
|
||||
did_modify_layer_stack();
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue