17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 01:30:16 +01:00

fix(editor): a track bent by its second control vector is drawn bent: the straightening of a straight with control vectors (world/Track.cpp) checked the first vector twice, so with it left along the straight the second one, dragged with the gizmo, changed the data but not the track drawn; now a straight only where both vectors lie along it or aren't given. A track bent by hand into an S between two points dragged is labelled with its length (L 77 m), not with a radius of many kilometres read off it; the "K: split here" by the cursor isn't shown while a point is dragged; Ctrl+Z takes away the warning by the cursor of what it took back (the paths that left the kept design). The tutorial clips of editing recorded again: selecting and fixing without the gizmo (a joint dragged, the warning read, Ctrl+Z), and the new one of editing with the gizmo (Q, a control vector dragged bending the track, W, E)

This commit is contained in:
maj00r
2026-10-25 12:57:23 +01:00
parent a312fd9935
commit 79a8c13586
7 changed files with 15 additions and 5 deletions

View File

@@ -452,9 +452,12 @@ void editor_mode::draw_track_labels() const
labels.push_back({2, -length, middle, format(STR_C("straight %.0f m"), length), IM_COL32(200, 215, 230, 225)});
continue;
}
// a track bent by hand, as an S between two points dragged, has no radius to read: its length alone
editor_track::curve shape;
if (editor_track::analyse_curve(run, m_route.design.norms.gauge, shape) && shape.radius >= 0.5)
if (editor_track::analyse_curve(run, m_route.design.norms.gauge, shape) && shape.radius >= 0.5 && shape.radius <= 50000.0)
labels.push_back({1, shape.radius, middle, curve_text(shape), IM_COL32(235, 235, 235, 240)});
else
labels.push_back({2, -length, middle, format("L %.0f m", length), IM_COL32(235, 235, 235, 240)});
}
std::sort(labels.begin(), labels.end(), [](track_label const &A, track_label const &B) { return A.rank != B.rank ? A.rank < B.rank : A.order < B.order; });
// each label where it reads best: beside its track if it's free there, else moved out to the nearest room, a line leading back