Add an outline to box selection rectangles for better visibility

This also refactors selection box color definitions
to avoid repetition.
This commit is contained in:
Hugo Locurcio 2019-08-15 22:17:08 +02:00
parent de8ce3e625
commit 108f9646f5
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
5 changed files with 33 additions and 15 deletions

View file

@ -2373,16 +2373,22 @@ void SpatialEditorViewport::_draw() {
get_stylebox("Focus", "EditorStyles")->draw(surface->get_canvas_item(), r);
}
RID ci = surface->get_canvas_item();
if (cursor.region_select) {
const Rect2 selection_rect = Rect2(cursor.region_begin, cursor.region_end - cursor.region_begin);
VisualServer::get_singleton()->canvas_item_add_rect(
ci,
Rect2(cursor.region_begin, cursor.region_end - cursor.region_begin),
get_color("accent_color", "Editor") * Color(1, 1, 1, 0.375));
surface->draw_rect(
selection_rect,
get_color("box_selection_fill_color", "Editor"));
surface->draw_rect(
selection_rect,
get_color("box_selection_stroke_color", "Editor"),
false,
Math::round(EDSCALE));
}
RID ci = surface->get_canvas_item();
if (message_time > 0) {
Ref<Font> font = get_font("font", "Label");
Point2 msgpos = Point2(5, get_size().y - 20);