An empty TraceTreeItemOwner's v_extents are no longer
[INT_MAX, INT_MIN] but [0, 0] instead. As new items were added
relative to the view's own v_extents, items were added at
positions close to the over-/underflow margin. This messed up
the scrollbar among other things. Returning [0, 0] instead
allows for better handling of such cases.
pair<int, int> TraceTreeItemOwner::v_extents() const
{
- pair<int, int> extents(INT_MAX, INT_MIN);
+ bool has_children = false;
+ pair<int, int> extents(INT_MAX, INT_MIN);
for (const shared_ptr<TraceTreeItem> t : trace_tree_child_items()) {
assert(t);
if (!t->enabled())
continue;
+ has_children = true;
+
const int child_offset = t->layout_v_offset();
const pair<int, int> child_extents = t->v_extents();
extents.first = min(child_extents.first + child_offset,
extents.second);
}
+ if (!has_children)
+ extents = make_pair(0, 0);
+
return extents;
}