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

fix(editor): K splits the selected track where the cursor points on screen (as the hover highlight finds it), not at the delayed depth pick which hit the ground beside the rail

This commit is contained in:
maj00r
2026-10-12 00:44:54 +02:00
parent 704511fe5e
commit 866f626668
3 changed files with 9 additions and 5 deletions

View File

@@ -92,16 +92,16 @@ double segment_distance2(glm::vec2 const &Point, glm::vec2 const &A, glm::vec2 c
} // namespace
editor_mode::track_hover editor_mode::track_under_cursor() const
editor_mode::track_hover editor_mode::track_under_cursor(TTrack const *Only) 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{kHoverPixels * kHoverPixels};
double best{Only != nullptr ? std::numeric_limits<double>::max() : kHoverPixels * kHoverPixels};
for (auto *track : simulation::Paths.sequence())
{
if (track == nullptr || false == rail(*track) || track->m_editorremoved)
if (track == nullptr || false == rail(*track) || track->m_editorremoved || (Only != nullptr && track != Only))
continue;
for (int i = 0; i < static_cast<int>(track->m_paths.size()); ++i)
{