1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Use builtin Vector2 functions for calculation of angles.

.
This commit is contained in:
Anilforextra
2021-09-06 12:17:50 +05:45
parent c97afc033f
commit a1f616dcfc
8 changed files with 11 additions and 11 deletions

View File

@@ -2927,7 +2927,7 @@ void CanvasItemEditor::_draw_ruler_tool() {
viewport->draw_string(font, text_pos, TS->format_number(vformat("%.1f px", length_vector.length())), HALIGN_LEFT, -1, font_size, font_color, outline_size, outline_color);
if (draw_secondary_lines) {
const real_t horizontal_angle_rad = atan2(length_vector.y, length_vector.x);
const real_t horizontal_angle_rad = length_vector.angle();
const real_t vertical_angle_rad = Math_PI / 2.0 - horizontal_angle_rad;
const int horizontal_angle = round(180 * horizontal_angle_rad / Math_PI);
const int vertical_angle = round(180 * vertical_angle_rad / Math_PI);