소스 검색

Merge pull request #35612 from timothyqiu/option-button-arrow

Fixes OptionButton minimum size
Rémi Verschelde 5 년 전
부모
커밋
5da20d6cf2
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      scene/gui/option_button.cpp

+ 8 - 1
scene/gui/option_button.cpp

@@ -36,7 +36,14 @@ Size2 OptionButton::get_minimum_size() const {
 	Size2 minsize = Button::get_minimum_size();
 
 	if (has_icon("arrow")) {
-		minsize.width += Control::get_icon("arrow")->get_width() + get_constant("hseparation");
+		const Size2 padding = get_stylebox("normal")->get_minimum_size();
+		const Size2 arrow_size = Control::get_icon("arrow")->get_size();
+
+		Size2 content_size = minsize - padding;
+		content_size.width += arrow_size.width + get_constant("hseparation");
+		content_size.height = MAX(content_size.height, arrow_size.height);
+
+		minsize = content_size + padding;
 	}
 
 	return minsize;