18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 10:24:58 +01:00

fix(editor): the drawn cursor is the editor's: off when it's left, back on when it's entered

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
This commit is contained in:
Claude
2026-11-11 11:34:38 +01:00
parent be7f9e4712
commit b691ef4d20
2 changed files with 10 additions and 2 deletions

View File

@@ -4186,8 +4186,11 @@ void editor_mode::render_view_menu()
ImGui::MenuItem(STR_C("Show lanes"), nullptr, &m_roadtool.lanes);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("The lanes of the roads drawn as the paths the vehicles take"));
if (ImGui::MenuItem(STR_C("Cursor drawn into the picture (streams)"), nullptr, ui_layer::drawn_cursor()))
ui_layer::draw_cursor(false == ui_layer::drawn_cursor());
if (ImGui::MenuItem(STR_C("Cursor drawn into the picture (streams)"), nullptr, m_draw_cursor))
{
m_draw_cursor = !m_draw_cursor;
ui_layer::draw_cursor(m_draw_cursor);
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("The pointer drawn by the editor into the frame instead of the one of the system: seen by those watching a stream\n"
"or a recording of the window (Discord, OBS, the capture of the system), which leave the system pointer out"));
@@ -6907,6 +6910,8 @@ void editor_mode::enter()
track_sleepers::lay_in_background(false);
// the editor may remove the tracks and the vehicles the recording refers to: it ends here
simulation::Blackbox.close();
// the cursor drawn into the picture is the editor's: back on when it comes back, if it was chosen
ui_layer::draw_cursor(m_draw_cursor);
if (simulation::Region != nullptr)
{
@@ -7006,6 +7011,8 @@ void editor_mode::exit()
{
m_ride.leave();
track_sleepers::lay_in_background(true);
// the driver's view has no menu to switch the drawn cursor off: the system one there
ui_layer::draw_cursor(false);
Global.editor_tracks = false;
EditorModeFlag = false;
Global.ControlPicking = m_statebackup.picking;

View File

@@ -240,6 +240,7 @@ class editor_mode : public application_mode, private editor_track::observer, pri
bool m_dragging = false;
glm::dvec3 oldPos; // world position of the last brush placement
bool m_brush_has_last{false}; // false at the start of a brush stroke, so the first placement ignores spacing
bool m_draw_cursor{false}; // the cursor drawn into the picture (View menu), on only while the editor is
bool mouseHold{false};
float kMaxPlacementDistance = 200.0f;
static bool m_change_history;