Browse Source

Implemented check_vadjust in CheckBox & CheckButton. It was exposed to the editor, but wasn't used.

Ken Paulson 6 years ago
parent
commit
deec700497

+ 1 - 0
doc/classes/CheckBox.xml

@@ -14,6 +14,7 @@
 	</constants>
 	</constants>
 	<theme_items>
 	<theme_items>
 		<theme_item name="check_vadjust" type="int" default="0">
 		<theme_item name="check_vadjust" type="int" default="0">
+			The vertical offset used when rendering the check icons.
 		</theme_item>
 		</theme_item>
 		<theme_item name="checked" type="Texture">
 		<theme_item name="checked" type="Texture">
 		</theme_item>
 		</theme_item>

+ 1 - 0
doc/classes/CheckButton.xml

@@ -14,6 +14,7 @@
 	</constants>
 	</constants>
 	<theme_items>
 	<theme_items>
 		<theme_item name="check_vadjust" type="int" default="0">
 		<theme_item name="check_vadjust" type="int" default="0">
+			The vertical offset used when rendering the icons.
 		</theme_item>
 		</theme_item>
 		<theme_item name="disabled" type="StyleBox">
 		<theme_item name="disabled" type="StyleBox">
 		</theme_item>
 		</theme_item>

+ 1 - 1
scene/gui/check_box.cpp

@@ -79,7 +79,7 @@ void CheckBox::_notification(int p_what) {
 
 
 		Vector2 ofs;
 		Vector2 ofs;
 		ofs.x = sb->get_margin(MARGIN_LEFT);
 		ofs.x = sb->get_margin(MARGIN_LEFT);
-		ofs.y = int((get_size().height - get_icon_size().height) / 2);
+		ofs.y = int((get_size().height - get_icon_size().height) / 2) + get_constant("check_vadjust");
 
 
 		if (is_pressed())
 		if (is_pressed())
 			on->draw(ci, ofs);
 			on->draw(ci, ofs);

+ 1 - 1
scene/gui/check_button.cpp

@@ -76,7 +76,7 @@ void CheckButton::_notification(int p_what) {
 		Size2 tex_size = get_icon_size();
 		Size2 tex_size = get_icon_size();
 
 
 		ofs.x = get_size().width - (tex_size.width + sb->get_margin(MARGIN_RIGHT));
 		ofs.x = get_size().width - (tex_size.width + sb->get_margin(MARGIN_RIGHT));
-		ofs.y = (get_size().height - tex_size.height) / 2;
+		ofs.y = (get_size().height - tex_size.height) / 2 + get_constant("check_vadjust");
 
 
 		if (is_pressed())
 		if (is_pressed())
 			on->draw(ci, ofs);
 			on->draw(ci, ofs);