|
@@ -1411,35 +1411,34 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
|
|
int prev_ofs = children_pos.y - cache.offset.y + p_draw_ofs.y;
|
|
int prev_ofs = children_pos.y - cache.offset.y + p_draw_ofs.y;
|
|
|
|
|
|
while (c) {
|
|
while (c) {
|
|
- if (cache.draw_relationship_lines > 0 && (!hide_root || c->parent != root)) {
|
|
|
|
- int root_ofs = children_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
|
|
|
|
- int parent_ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
|
|
|
|
- Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h / 2) - cache.offset + p_draw_ofs;
|
|
|
|
|
|
+ if (htotal >= 0) {
|
|
|
|
+ int child_h = draw_item(children_pos, p_draw_ofs, p_draw_size, c);
|
|
|
|
|
|
- if (c->get_children() != nullptr) {
|
|
|
|
- root_pos -= Point2i(cache.arrow->get_width(), 0);
|
|
|
|
- }
|
|
|
|
|
|
+ // Draw relationship lines.
|
|
|
|
+ if (cache.draw_relationship_lines > 0 && (!hide_root || c->parent != root)) {
|
|
|
|
+ int root_ofs = children_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
|
|
|
|
+ int parent_ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
|
|
|
|
+ Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h / 2) - cache.offset + p_draw_ofs;
|
|
|
|
|
|
- float line_width = 1.0;
|
|
|
|
|
|
+ if (c->get_children() != nullptr) {
|
|
|
|
+ root_pos -= Point2i(cache.arrow->get_width(), 0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ float line_width = 1.0;
|
|
#ifdef TOOLS_ENABLED
|
|
#ifdef TOOLS_ENABLED
|
|
- line_width *= EDSCALE;
|
|
|
|
|
|
+ line_width *= EDSCALE;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- Point2i parent_pos = Point2i(parent_ofs - cache.arrow->get_width() / 2, p_pos.y + label_h / 2 + cache.arrow->get_height() / 2) - cache.offset + p_draw_ofs;
|
|
|
|
|
|
+ Point2i parent_pos = Point2i(parent_ofs - cache.arrow->get_width() / 2, p_pos.y + label_h / 2 + cache.arrow->get_height() / 2) - cache.offset + p_draw_ofs;
|
|
|
|
|
|
- if (root_pos.y + line_width >= 0) {
|
|
|
|
- VisualServer::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);
|
|
|
|
- VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y), Point2i(parent_pos.x, prev_ofs), cache.relationship_line_color, line_width);
|
|
|
|
- }
|
|
|
|
|
|
+ if (root_pos.y + line_width >= 0) {
|
|
|
|
+ // Order of parts on this bend: the horizontal line first, then the vertical line.
|
|
|
|
+ VisualServer::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);
|
|
|
|
+ VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y), Point2i(parent_pos.x, prev_ofs), cache.relationship_line_color, line_width);
|
|
|
|
+ }
|
|
|
|
|
|
- if (htotal < 0) {
|
|
|
|
- return -1;
|
|
|
|
|
|
+ prev_ofs = root_pos.y;
|
|
}
|
|
}
|
|
- prev_ofs = root_pos.y;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (htotal >= 0) {
|
|
|
|
- int child_h = draw_item(children_pos, p_draw_ofs, p_draw_size, c);
|
|
|
|
|
|
|
|
if (child_h < 0) {
|
|
if (child_h < 0) {
|
|
if (cache.draw_relationship_lines == 0) {
|
|
if (cache.draw_relationship_lines == 0) {
|