Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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