summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-04-05 16:50:54 +0200
committerGitHub <noreply@github.com>2019-04-05 16:50:54 +0200
commite16fc72cef5769ddbb18375b9dd1ed40e82b646b (patch)
tree31632535c7dd2ad5a5e37796d95ee6a34637b4b1
parent963165065df185e6e1727596c743c1bc7e4aa49b (diff)
parented06ed38fb122605a6b7411cc2bd7bc7c9a51b6d (diff)
Merge pull request #26903 from guzzard/polygon-point-hover
Display vertex number when hovering point in collision polygon
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 28f786e99a..4a4e7f25b8 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -638,6 +638,13 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl
const Color modulate = vertex == active_point ? Color(0.5, 1, 2) : Color(1, 1, 1);
p_overlay->draw_texture(handle, point - handle->get_size() * 0.5, modulate);
+
+ if (vertex == hover_point) {
+ Ref<Font> font = get_font("font", "Label");
+ String num = String::num(vertex.vertex);
+ Size2 num_size = font->get_string_size(num);
+ p_overlay->draw_string(font, point - num_size * 0.5, num, Color(1.0, 1.0, 1.0, 0.5));
+ }
}
}