18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 22:07:55 +01:00

fix(editor): the lay panel says "Laid" only while the step it was laid with is on top of the history

lay_panel_state() told the line laid from laid_step == m_history.size(). Lay, Ctrl+Z, then any one-step edit made the size the
same again, and the panel said "Laid … Ctrl+Z undoes" for a line that was gone; at the cap of 200 steps it stayed "laid" for
good. The panel now compares the serial of the step on top of the history (EditorSnapshot::serial), which each step made has
of its own.
This commit is contained in:
maj00r
2026-11-24 18:56:11 +01:00
parent 2217da8648
commit da1ef628bf
2 changed files with 14 additions and 5 deletions
+8 -3
View File
@@ -2141,7 +2141,7 @@ void editor_mode::lay_finish(editor_track::snap_target const &End)
tool.points.clear();
tool.modes.clear();
tool.start = {};
tool.laid_step = m_history.size();
tool.laid_step = history_top();
straight_refresh();
}
@@ -2152,7 +2152,7 @@ void editor_mode::lay_told(double const Length, std::size_t const Tracks)
tool.status_time = ImGui::GetTime();
tool.laid_now = true;
tool.notes_open = false;
tool.laid_step = m_history.size();
tool.laid_step = history_top();
}
void editor_mode::lay_enter()
@@ -2352,13 +2352,18 @@ alignment::limits editor_mode::laying_norms() const
return norms;
}
std::uint64_t editor_mode::history_top() const
{
return m_history.empty() ? 0 : m_history.back().serial;
}
editor_mode::lay_state editor_mode::lay_panel_state() const
{
if (m_extend.active)
return lay_state::extending;
if (false == m_lay.points.empty())
return lay_state::clicking;
if (m_lay.laid_now && m_lay.laid_step == m_history.size())
if (m_lay.laid_now && m_lay.laid_step == history_top())
return lay_state::laid;
return lay_state::ready;
}