mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 09:15:01 +01:00
fix(editor): a road point picked on the screen only when nothing is under the cursor, and not through it; Alt+drag dropped with Esc, the work area or the window, no undo in the middle of it
The click takes the point by the ground clicked, then the piece or the junction under the cursor; the point nearest on the screen only when there's none, no farther than what is under the cursor and a bit beyond it, by whole pixels first and the range then, so the order of the roads doesn't decide. The ends of the pieces are gone through without looking for the repeated ones (editor_road::each_joint), joints() isn't needed. Esc, the road window closed, another tool or the track work area drop the drag; Ctrl+Z and Ctrl+Y wait for its end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
This commit is contained in:
@@ -1621,22 +1621,15 @@ bool editor_road::nearest_joint(glm::dvec3 const &Point, double const Radius, gl
|
||||
return found;
|
||||
}
|
||||
|
||||
std::vector<glm::dvec3> editor_road::joints()
|
||||
void editor_road::each_joint(std::function<void(glm::dvec3 const &)> const &Visit)
|
||||
{
|
||||
std::vector<glm::dvec3> result;
|
||||
for (auto const *road : simulation::Roads.sequence())
|
||||
{
|
||||
if (road == nullptr || road->m_editorremoved)
|
||||
continue;
|
||||
for (auto const atend : {false, true})
|
||||
{
|
||||
auto const position{axis_end(road->definition(), atend)};
|
||||
auto const same = [&position](glm::dvec3 const &Listed) { return glm::distance(Listed, position) < kSamePoint; };
|
||||
if (std::none_of(result.begin(), result.end(), same))
|
||||
result.push_back(position);
|
||||
}
|
||||
Visit(axis_end(road->definition(), false));
|
||||
Visit(axis_end(road->definition(), true));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<editor_road::piece_end> editor_road::ends_at(glm::dvec3 const &Point)
|
||||
|
||||
Reference in New Issue
Block a user