Skip to content

Commit 728c159

Browse files
committed
Merge pull request #114783 from mxtherfxcker/fix/graphframe-incorrect-size
Fix GraphFrame titlebar incorrect sizing with custom stylebox
2 parents 996e1d1 + 3be861c commit 728c159

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scene/gui/graph_frame.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ void GraphFrame::_notification(int p_what) {
103103
Ref<StyleBoxFlat> sb_panel_flat = sb_to_draw_panel;
104104
Ref<StyleBoxTexture> sb_panel_texture = sb_to_draw_panel;
105105

106-
Rect2 titlebar_rect(Point2(), titlebar_hbox->get_size() + sb_titlebar->get_minimum_size());
106+
Rect2 titlebar_rect(Point2(), titlebar_hbox->get_combined_minimum_size() + sb_titlebar->get_minimum_size());
107107
Size2 body_size = get_size();
108+
titlebar_rect.size.width = body_size.width;
108109
body_size.y -= titlebar_rect.size.height;
109110
Rect2 body_rect(Point2(0, titlebar_rect.size.height), body_size);
110111

@@ -265,7 +266,7 @@ HBoxContainer *GraphFrame::get_titlebar_hbox() {
265266
}
266267

267268
Size2 GraphFrame::get_titlebar_size() const {
268-
return titlebar_hbox->get_size() + theme_cache.titlebar->get_minimum_size();
269+
return titlebar_hbox->get_combined_minimum_size() + theme_cache.titlebar->get_minimum_size();
269270
}
270271

271272
void GraphFrame::set_drag_margin(int p_margin) {
@@ -304,7 +305,7 @@ bool GraphFrame::has_point(const Point2 &p_point) const {
304305
}
305306

306307
// For grabbing on the titlebar.
307-
int titlebar_height = titlebar_hbox->get_size().height + sb_titlebar->get_minimum_size().height;
308+
int titlebar_height = titlebar_hbox->get_combined_minimum_size().height + sb_titlebar->get_minimum_size().height;
308309
if (Rect2(0, 0, get_size().width, titlebar_height).has_point(p_point)) {
309310
return true;
310311
}

0 commit comments

Comments
 (0)