Fix disappearing relationship lines in Tree when item is out of view
This commit is contained in:
parent
b6f381475f
commit
231daa6025
|
@ -1865,18 +1865,24 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
|
|||
prev_hl_ofs = root_pos.y + Math::floor(parent_line_width / 2);
|
||||
} else if (p_item->is_selected(0)) {
|
||||
// If parent item is selected (but this item is not), we draw the line using children highlight style.
|
||||
// Siblings of the selected branch can be drawn with a slight offset (and also don't need a vertical line).
|
||||
// Siblings of the selected branch can be drawn with a slight offset and their vertical line must appear as highlighted.
|
||||
if (_is_sibling_branch_selected(c)) {
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x + Math::floor(parent_line_width / 2), root_pos.y), cache.children_hl_line_color, children_line_width);
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y + Math::floor(parent_line_width / 2)), Point2i(parent_pos.x, prev_hl_ofs), cache.parent_hl_line_color, parent_line_width);
|
||||
|
||||
prev_hl_ofs = root_pos.y + Math::floor(parent_line_width / 2);
|
||||
} else {
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x + Math::floor(children_line_width / 2), root_pos.y), cache.children_hl_line_color, children_line_width);
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y + Math::floor(children_line_width / 2)), Point2i(parent_pos.x, prev_ofs + Math::floor(children_line_width / 2)), cache.children_hl_line_color, children_line_width);
|
||||
}
|
||||
} else {
|
||||
// If nothing of the above is true, we draw the line using normal style.
|
||||
// Siblings of the selected branch can be drawn with a slight offset (and also don't need a vertical line).
|
||||
// Siblings of the selected branch can be drawn with a slight offset and their vertical line must appear as highlighted.
|
||||
if (_is_sibling_branch_selected(c)) {
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x + cache.parent_hl_line_margin, root_pos.y), cache.relationship_line_color, line_width);
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y + Math::floor(parent_line_width / 2)), Point2i(parent_pos.x, prev_hl_ofs), cache.parent_hl_line_color, parent_line_width);
|
||||
|
||||
prev_hl_ofs = root_pos.y + Math::floor(parent_line_width / 2);
|
||||
} else {
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x + Math::floor(line_width / 2), root_pos.y), cache.relationship_line_color, line_width);
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y + Math::floor(line_width / 2)), Point2i(parent_pos.x, prev_ofs + Math::floor(line_width / 2)), cache.relationship_line_color, line_width);
|
||||
|
|
Loading…
Reference in New Issue