Skip to content

Commit

Permalink
Merge pull request #26903 from guzzard/polygon-point-hover
Browse files Browse the repository at this point in the history
Display vertex number when hovering point in collision polygon
  • Loading branch information
akien-mga authored Apr 5, 2019
2 parents 9631650 + ed06ed3 commit e16fc72
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions editor/plugins/abstract_polygon_2d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}

Expand Down

0 comments on commit e16fc72

Please sign in to comment.