mirror of
https://github.com/godotengine/godot.git
synced 2024-12-06 11:02:27 +00:00
Merge pull request #31399 from Calinou/box-selection-add-borders
Add an outline to box selection rectangles for better visibility
This commit is contained in:
commit
be42f1bf6c
@ -5050,10 +5050,9 @@ float AnimationTrackEditor::get_moving_selection_offset() const {
|
||||
|
||||
void AnimationTrackEditor::_box_selection_draw() {
|
||||
|
||||
Color color = get_color("accent_color", "Editor");
|
||||
color.a = 0.2;
|
||||
Rect2 rect = Rect2(Point2(), box_selection->get_size());
|
||||
box_selection->draw_rect(rect, color);
|
||||
const Rect2 selection_rect = Rect2(Point2(), box_selection->get_size());
|
||||
box_selection->draw_rect(selection_rect, get_color("box_selection_fill_color", "Editor"));
|
||||
box_selection->draw_rect(selection_rect, get_color("box_selection_stroke_color", "Editor"), false, Math::round(EDSCALE));
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||
|
@ -351,6 +351,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
theme->set_color("dark_color_3", "Editor", dark_color_3);
|
||||
theme->set_color("contrast_color_1", "Editor", contrast_color_1);
|
||||
theme->set_color("contrast_color_2", "Editor", contrast_color_2);
|
||||
theme->set_color("box_selection_fill_color", "Editor", accent_color * Color(1, 1, 1, 0.3));
|
||||
theme->set_color("box_selection_stroke_color", "Editor", accent_color * Color(1, 1, 1, 0.8));
|
||||
|
||||
theme->set_color("font_color", "Editor", font_color);
|
||||
theme->set_color("highlighted_font_color", "Editor", font_color_hl);
|
||||
|
@ -2918,10 +2918,15 @@ void CanvasItemEditor::_draw_selection() {
|
||||
Point2 bsfrom = transform.xform(drag_from);
|
||||
Point2 bsto = transform.xform(box_selecting_to);
|
||||
|
||||
VisualServer::get_singleton()->canvas_item_add_rect(
|
||||
ci,
|
||||
viewport->draw_rect(
|
||||
Rect2(bsfrom, bsto - bsfrom),
|
||||
get_color("accent_color", "Editor") * Color(1, 1, 1, 0.375));
|
||||
get_color("box_selection_fill_color", "Editor"));
|
||||
|
||||
viewport->draw_rect(
|
||||
Rect2(bsfrom, bsto - bsfrom),
|
||||
get_color("box_selection_stroke_color", "Editor"),
|
||||
false,
|
||||
Math::round(EDSCALE));
|
||||
}
|
||||
|
||||
if (drag_type == DRAG_ROTATE) {
|
||||
|
@ -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);
|
||||
|
@ -776,10 +776,16 @@ void GraphEdit::_top_layer_draw() {
|
||||
_draw_cos_line(top_layer, pos, topos, col, col);
|
||||
}
|
||||
|
||||
if (box_selecting)
|
||||
if (box_selecting) {
|
||||
top_layer->draw_rect(
|
||||
box_selecting_rect,
|
||||
get_color("accent_color", "Editor") * Color(1, 1, 1, 0.375));
|
||||
get_color("box_selection_fill_color", "Editor"));
|
||||
|
||||
top_layer->draw_rect(
|
||||
box_selecting_rect,
|
||||
get_color("box_selection_stroke_color", "Editor"),
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEdit::set_selected(Node *p_child) {
|
||||
|
Loading…
Reference in New Issue
Block a user