17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-28 16:57:29 +01:00

feat(editor): norms of laying, free by default: free lays plain arcs with no transition curves and no cant and keeps quiet about the norms, PKP PLK gives the transitions and the cant for the design speed with the warnings, chosen at the top of the Lay panel; digits in Tracks only type values, never change the edit mode; in Lay a track under the cursor says the click starts on the ground beside it, Shift+click chooses it for a parallel track; Alt while laying turns the direction in steps of 15 degrees, with the azimuth by the cursor; K splits only within 20 px of the selected track, where a marker shows it; the environment, overhead line, transition curve, view and include labels translated, one name for laying track in Polish

This commit is contained in:
maj00r
2026-10-12 01:35:39 +02:00
parent f28640dd44
commit 7fea51ad06
7 changed files with 175 additions and 26 deletions

View File

@@ -92,13 +92,13 @@ double segment_distance2(glm::vec2 const &Point, glm::vec2 const &A, glm::vec2 c
} // namespace
editor_mode::track_hover editor_mode::track_under_cursor(TTrack const *Only) const
editor_mode::track_hover editor_mode::track_under_cursor(TTrack const *Only, float const Pixels) const
{
track_hover result;
auto const &io{ImGui::GetIO()};
screen_projection const projection;
glm::vec2 const mouse{io.MousePos.x, io.MousePos.y};
double best{Only != nullptr ? std::numeric_limits<double>::max() : kHoverPixels * kHoverPixels};
double best{Pixels > 0.0f ? Pixels * Pixels : Only != nullptr ? std::numeric_limits<double>::max() : kHoverPixels * kHoverPixels};
for (auto *track : simulation::Paths.sequence())
{
if (track == nullptr || false == rail(*track) || track->m_editorremoved || (Only != nullptr && track != Only))
@@ -216,6 +216,15 @@ editor_mode::track_intent editor_mode::track_intent_at(int const Mods)
return make(kind::lay_end, lay.points.empty() ? "Click: start from this free end, drag: lead a track out of it" : "Click: join this end and lay");
}
intent.position = lay.mouse;
if (lay.points.empty())
if (auto const under{track_under_cursor()}; under.track != nullptr)
{
intent.track = under.track;
intent.path = under.path;
if (shift)
return make(kind::select, "Click: choose this track, the parallel track goes beside it");
return make(kind::lay, "Click: start on the ground beside this track. Shift+click: a parallel track to it, T: a switch into it");
}
return make(kind::lay, lay.points.empty() ? "Click: start of the new track" : "Click: lay the track to here");
}
if (m_track_tab == track_tab::turntable)