Skip to content

Commit

Permalink
Merge pull request #45164 from Calinou/texture-region-editor-line-bac…
Browse files Browse the repository at this point in the history
…kground

Draw a "background" line behind the dashed line in TextureRegion editor
  • Loading branch information
akien-mga authored Jan 15, 2021
2 parents 9a2f848 + 656aba1 commit d1f2644
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion editor/plugins/texture_region_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,21 @@

void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) {
Vector2 line = (to - from).normalized() * 10;

// Draw a translucent background line to make the foreground line visible on any background.
edit_draw->draw_line(
from,
to,
EditorNode::get_singleton()->get_theme_base()->get_theme_color("mono_color", "Editor").inverted() * Color(1, 1, 1, 0.5),
Math::round(2 * EDSCALE));

while ((to - from).length_squared() > 200) {
edit_draw->draw_line(from, from + line, EditorNode::get_singleton()->get_theme_base()->get_theme_color("mono_color", "Editor"), 2);
edit_draw->draw_line(
from,
from + line,
EditorNode::get_singleton()->get_theme_base()->get_theme_color("mono_color", "Editor"),
Math::round(2 * EDSCALE));

from += line * 2;
}
}
Expand Down

0 comments on commit d1f2644

Please sign in to comment.