mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-03 01:30:16 +01:00
refactor(editor): the helpers repeated over the editor files are shared
The name of a node or "(no name)" was written out in twenty places and four local functions, a lower-case copy of a text in four files, the test for a number, the file name of a template made comparable and the heading of a direction in three and two, the green main button of a panel in five and the key=value parameters of a self-test command in five. Each of them is one helper now: name_of, tall_button_height and main_button with the panel helpers, numeric with format, normalized with the include helpers, heading_of with the plan geometry and selftest_values with the tools; lower gives way to ToLower.
This commit is contained in:
@@ -1159,7 +1159,7 @@ glm::dvec3 editor_mode::lay_angle_snap(glm::dvec3 const &Mouse, std::string &Lab
|
||||
ratio = n;
|
||||
}
|
||||
}
|
||||
auto const name{axis->name().empty() ? std::string{STR_C("(no name)")} : axis->name()};
|
||||
auto const name{name_of(*axis)};
|
||||
auto const degrees{glm::degrees(std::abs(std::remainder(angle, glm::pi<double>())))};
|
||||
Label = ratio > 0.0 ? format(STR_C("1:%g to %s"), ratio, name.c_str()) : degrees < 0.1 ? format(STR_C("parallel to %s"), name.c_str()) : format(STR_C("%.0f deg to %s"), degrees, name.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user