17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-01 08:02:10 +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:
maj00r
2026-10-21 11:09:06 +02:00
parent 7da0432dca
commit ddde8d12d9
6 changed files with 33 additions and 2 deletions

View File

@@ -638,6 +638,7 @@ void editor_mode::render_straight_gizmo()
if (false == state.fitting)
{
push_track_snapshot(state.drag_states);
state.drag_step = m_history.size();
m_track_drag = tracks;
}
}
@@ -731,6 +732,7 @@ void editor_mode::cancel_track_tools()
m_track_dirty = true;
commit_track_drag(true);
m_track_drag.clear();
drop_step(state.drag_step);
}
state.dragging = false;
state.fitting = false;
@@ -743,10 +745,22 @@ void editor_mode::cancel_track_tools()
m_signal.placing = false;
m_signal.moving = false;
m_handle_drag = {};
if (m_route_dragging)
{
m_route_dragging = false;
m_route.design = m_route_drag_from;
route_update();
}
if (m_point_drag.active)
{
auto const step{m_point_drag.moved ? m_point_drag.step : 0};
m_track_snap = {};
point_drag_finish();
m_record_watch = {};
m_point_drag = {};
m_track_drag.clear();
m_track_drag_points.clear();
m_track_joints.clear();
drop_step(step);
}
if (m_switch.placing)
{