17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-01 05:42:44 +01:00

feat(editor): a switch laid with no track there, and no switch laid by a click: a press on the ground with a switch armed lays the switch there, its start where it was pressed, the direction of its main track taken from the drag once it's 4 m long and held, the drag sideways then giving the side of the diverging track, back by the start the direction free again; pressed by a free end within 5 m it goes on from that end in its direction and grade, joined to it. Its ends are left free to lay on from, styled after the track it goes on from or as the lay tool lays its tracks (editor_track::create_switch with a path_style). A press let go within 10 pixels places no switch, a slip at a crossing included, which was laid at once on the press: it's laid once dragged, its straights shown meanwhile. The hints and the panel tell of both. Selftest switchfree: Rz 60E1-300-1:9 on the ground with its four ends free, from the free end of a straight joined and walked through; a click on a straight laid none, a drag laid z1

This commit is contained in:
maj00r
2026-10-27 19:33:23 +01:00
parent 1340017be3
commit f8a12107a0
12 changed files with 342 additions and 15 deletions

View File

@@ -139,7 +139,7 @@ std::string template_tooltip(editor_track::switch_template const &Template)
text += "\n";
text += Template.type == "Rkp" ? STR_C("Single slip (Rkp)") : Template.type == "Rkpd" ? STR_C("Double slip (Rkpd)") : STR_C("Crossing (Skrz)");
text += "\n" + format(STR_C("a %.3f m from the middle of the crossing to the joint"), Template.a) + "\n";
text += Template.type == "Rkp" ? STR_C("Click at a crossing of two straights, on the side of the tracks to join") : STR_C("Click at a crossing of two straights");
text += Template.type == "Rkp" ? STR_C("Drag at a crossing of two straights, on the side of the tracks to join") : STR_C("Drag at a crossing of two straights");
return text;
}
text += "\n" + format(STR_C("a %.3f m to the centre of the switch, b %.3f m on to its end"), Template.a, Template.b);
@@ -275,13 +275,13 @@ void editor_mode::render_switch_ui()
switch (kind)
{
case switch_kind::slip:
case switch_kind::crossing: how = {{"LMB on a crossing", "of two straights: it goes there"}}; break;
case switch_kind::crossing: how = {{"Drag at a crossing", "of two straights: it goes there"}}; break;
case switch_kind::connection:
how = {{"Drag", "from a straight onto the other track"}, {"Shift+wheel", "the kind"}, {"Ctrl+wheel", "R of the aligning curve"}};
if (tool.connection == static_cast<int>(connection::kind::double_crossover))
how.push_back({"Alt+wheel", "where they meet"});
break;
default: how = {{"Drag on a track", "along: the direction, sideways: the side"}}; break;
default: how = {{"Drag on a track", "along: the direction, sideways: the side"}, {"Drag on the ground", "a switch with no track, on from a free end near it"}}; break;
}
gesture_rows(how);