mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 05:49:13 +01:00
fix(editor): Esc takes back what a drag did
Esc in the middle of dragging a point of a track kept the moved point, and the hint said so; dragging a straight was taken back but left an empty step in the history; a vertex or the radius grip of a curve stayed moved in the design. Now Esc puts back what was there before the drag in all three, and the history doesn't keep a step for it.
This commit is contained in:
@@ -973,6 +973,16 @@ void editor_mode::undo_last()
|
||||
}
|
||||
}
|
||||
|
||||
void editor_mode::drop_step(std::size_t const Step)
|
||||
{
|
||||
if (Step == 0 || m_history.size() != Step)
|
||||
return;
|
||||
auto const redo{g_redo.size()};
|
||||
undo_one();
|
||||
if (g_redo.size() > redo)
|
||||
g_redo.erase(g_redo.begin() + redo, g_redo.end());
|
||||
}
|
||||
|
||||
void editor_mode::undo_one()
|
||||
{
|
||||
if (m_history.empty())
|
||||
|
||||
Reference in New Issue
Block a user