Draw a "background" line behind the dashed line in TextureRegion editor

This makes the dashed line visible on any background.

(cherry picked from commit 656aba1273)
This commit is contained in:
Hugo Locurcio 2021-01-13 17:20:29 +01:00 committed by Rémi Verschelde
parent b124c0c466
commit ba04de6893
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -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_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_color("mono_color", "Editor"), 2);
edit_draw->draw_line(
from,
from + line,
EditorNode::get_singleton()->get_theme_base()->get_color("mono_color", "Editor"),
Math::round(2 * EDSCALE));
from += line * 2;
}
}