17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 17:59:19 +02:00

feat(editor): the top view zooms out to 50 km for a whole line, from 0.5 m per pixel the rail tracks are drawn as thin lines and the hover reaches 16 px around them, only the tracks near the cursor are checked; handles drag beyond 200 m from the camera in Tracks; Plan works with the mouse alone and without the gizmo: the grips of a straight, the vertices and the radius of a curve drag directly, the break tool is press on the straight and drag, the panel tool stays chosen afterwards, the Q/W/E bar is hidden in Plan; self-test command ortho

This commit is contained in:
maj00r
2026-10-12 02:49:07 +02:00
parent 16c90eb674
commit f81698eaf1
7 changed files with 120 additions and 111 deletions

View File

@@ -1407,6 +1407,8 @@ bool editor_mode::update()
render_viewport_overlays();
render_track_inspector();
if (ui()->mode() == nodebank_panel::TRACK)
draw_track_lines();
if (selected_track())
draw_track_overlay();
if (route_active())
@@ -4780,7 +4782,7 @@ void editor_mode::render_gizmo_options()
{
ImGui::SameLine();
ImGui::SetNextItemWidth(120.0f);
ImGui::SliderFloat(STR_C("Extent (m), wheel / MMB pan"), &Global.EditorOrthoExtent, 5.0f, 5000.0f, "%.0f", ImGuiSliderFlags_Logarithmic);
ImGui::SliderFloat(STR_C("Extent (m), wheel / MMB pan"), &Global.EditorOrthoExtent, 5.0f, 50000.0f, "%.0f", ImGuiSliderFlags_Logarithmic);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("Wheel zooms. Hold the wheel and drag to pan."));
}
@@ -4825,6 +4827,18 @@ void editor_mode::render_gizmo_options()
void editor_mode::render_gizmo()
{
if (straights_active())
{
render_straight_gizmo();
return;
}
if (route_active())
{
render_route_gizmo();
return;
}
// the transform gizmo is suppressed while editing terrain, so the brush/chunk tool owns the mouse
if (!m_gizmo_enabled || terrain_brush() || terrain_clicking())
{
@@ -4838,18 +4852,6 @@ void editor_mode::render_gizmo()
return;
}
if (straights_active())
{
render_straight_gizmo();
return;
}
if (route_active())
{
render_route_gizmo();
return;
}
if (!m_node && m_instance == 0)
{
m_gizmo_using = false;
@@ -5123,7 +5125,7 @@ void editor_mode::on_scroll(double const Xoffset, double const Yoffset)
if (false == Global.EditorOrtho || ImGui::GetIO().WantCaptureMouse)
return;
auto const before{Global.EditorOrthoExtent};
auto const after{std::clamp(before * static_cast<float>(std::pow(0.85, Yoffset)), 5.0f, 5000.0f)};
auto const after{std::clamp(before * static_cast<float>(std::pow(0.85, Yoffset)), 5.0f, 50000.0f)};
screen_projection const projection;
glm::dvec3 origin;
glm::dvec3 direction;
@@ -5288,7 +5290,7 @@ void editor_mode::exit()
m_track_snap = {};
m_track_point = {};
m_route = {};
m_route_gizmo_using = false;
m_route_dragging = false;
if (Global.EditorOrtho)
toggle_ortho();