18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 10:24:58 +01:00

feat(editor): the points of the roads picked on the screen, also under the terrain; Alt+drag their height

The points where the pieces of a road meet were picked only by the ground clicked: one more than 3 m above or below the
ground under the cursor (a road taken down into a cutting, under an embankment) couldn't be picked again. Now the point
nearest to the cursor on the screen (within 12 px, the one nearer to the camera of those about as near) is picked first,
the ground as before after it.

Alt+LMB on a point and dragging up or down changes the height of the selected points (Ctrl: ten times finer); the change
shows as yellow lines and a label by the cursor while dragging, and is applied, as one step of the history, when the button
is let go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
This commit is contained in:
Claude
2026-11-09 23:16:38 +01:00
parent 823807201c
commit 6684baefc3
5 changed files with 148 additions and 3 deletions

View File

@@ -1923,6 +1923,11 @@ class editor_mode : public application_mode, private editor_track::observer
bool follow{true}; // built roads are led over the ground between the clicked points
float crossingspeed{30.f}; // speed limit on the junctions being made
float heightstep{0.1f}; // how much the selected points are raised or lowered at a time
// Alt+LMB on a point dragged up or down: the heights of the selected points changed by the drag, applied when let go
bool lifting{false};
float lift_mouse{0.0f}; // where on the screen the drag began, pixels down
double lift_scale{0.0}; // metres for a pixel at the point picked
std::vector<double> lift_from; // the heights of the selected points when the drag began
bool ring{false}; // the build tool makes roundabouts
float ringradius{15.f}; // of the middle of the road going around
std::string island{"none"}; // what the middle of a roundabout is covered with
@@ -1967,6 +1972,13 @@ class editor_mode : public application_mode, private editor_track::observer
void draw_road_overlay() const;
void update_road_tool();
void road_click();
// the point where pieces meet or end nearest to the cursor on the screen, within a few pixels; it's found under the
// terrain too, where the click on the ground doesn't get near it
bool road_joint_on_screen(glm::dvec3 &Joint) const;
// Alt+LMB: the drag of the heights of the selected points begun on a point, and finished
bool road_lift_start();
void road_lift_finish();
double road_lift_offset() const;
void road_select(road_node *Road);
void junction_select(junction_node *Junction);
void road_apply();