diff --git a/application/editormode.cpp b/application/editormode.cpp index d471cf83..c313ed77 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -965,6 +965,8 @@ void editor_mode::restore_terrain(EditorSnapshot &Snapshot) void editor_mode::undo_last() { first_step_done(first_step::undo); + // the warning by the cursor told of the step taken back now: "Ctrl+Z takes it back" is done + ui()->drop_refusal(); // a change of the terrain made a moment ago is a step of its own before it's taken back m_history_busy = true; terrain_history_step(); diff --git a/application/editormodetrack.cpp b/application/editormodetrack.cpp index fed97ccd..4d7c8c6e 100644 --- a/application/editormodetrack.cpp +++ b/application/editormodetrack.cpp @@ -2267,7 +2267,8 @@ void editor_mode::draw_build_overlay() const projection.line(drawlist, origin + glm::dvec3{i * cell, 0.0, j * cell}, origin + glm::dvec3{(i + 1) * cell, 0.0, j * cell}, colour, 1.0f); } } - if (m_track_tab == track_tab::path && false == m_lay.active && false == m_track_gizmo_using) + // none while a point is dragged: there is nothing to split then + if (m_track_tab == track_tab::path && false == m_lay.active && false == m_track_gizmo_using && false == m_point_drag.active && false == m_handle_drag.active) if (auto const spot{split_spot()}; spot.track != nullptr) { ImVec2 at; diff --git a/application/editormodetrackux.cpp b/application/editormodetrackux.cpp index fc2d3c80..9ce81c89 100644 --- a/application/editormodetrackux.cpp +++ b/application/editormodetrackux.cpp @@ -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 diff --git a/application/editoruilayer.h b/application/editoruilayer.h index 6858c287..f058e629 100644 --- a/application/editoruilayer.h +++ b/application/editoruilayer.h @@ -169,6 +169,8 @@ class editor_ui : public ui_layer void set_status(std::string const &Status, bool const Error = false); // a warning after an operation done: added to its status, shown by the cursor for a while void set_notice(std::string const &Notice); + // the refusal or warning by the cursor taken away before its time, when what it tells of was taken back + void drop_refusal() { m_refusal.clear(); } private: // methods diff --git a/lang/editor_tutorial/edit.gif b/lang/editor_tutorial/edit.gif index f64ed420..e8aa5e16 100644 Binary files a/lang/editor_tutorial/edit.gif and b/lang/editor_tutorial/edit.gif differ diff --git a/lang/editor_tutorial/gizmo.gif b/lang/editor_tutorial/gizmo.gif new file mode 100644 index 00000000..c5f192c3 Binary files /dev/null and b/lang/editor_tutorial/gizmo.gif differ diff --git a/world/Track.cpp b/world/Track.cpp index e57fa715..771ae2e8 100644 --- a/world/Track.cpp +++ b/world/Track.cpp @@ -836,9 +836,11 @@ void TTrack::init_segments( bool const Initial ) { } // length2 is better than length for comparing because it does not require sqrt function - if( glm::length2((p1 + p1 + p2) / 3.0 - p1 - cp1) < sq(0.02) - || glm::length2((p1 + p2 + p2) / 3.0 - p2 + cp1) < sq(0.02) ) { - // "prostowanie" prostych z kontrolnymi, dokładność 2cm + // "prostowanie" prostych z kontrolnymi, dokładność 2cm: a straight only where both control vectors lie along it, or aren't + // given; one of them moved off it, the other one left where a straight has it, makes a curve + auto const startalong { cp1 == glm::dvec3() || glm::length2( ( p1 + p1 + p2 ) / 3.0 - p1 - cp1 ) < sq( 0.02 ) }; + auto const endalong { cp2 == glm::dvec3() || glm::length2( ( p1 + p2 + p2 ) / 3.0 - p2 - cp2 ) < sq( 0.02 ) }; + if( startalong && endalong ) { cp1 = cp2 = glm::dvec3(0, 0, 0); }