浏览代码

Button focus hovering

Signed-off-by: Anthony Fieroni [email protected]
Anthony Fieroni 9 年之前
父节点
当前提交
6d21fd42d3
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      scene/gui/base_button.cpp

+ 10 - 0
scene/gui/base_button.cpp

@@ -243,12 +243,22 @@ void BaseButton::_notification(int p_what) {
 			update();
 		}
 	}
+	
+	if (p_what==NOTIFICATION_FOCUS_ENTER) {
+		
+		status.hovering=true;
+		update();
+	}
 
 	if (p_what==NOTIFICATION_FOCUS_EXIT) {
 
 		if (status.pressing_button && status.press_attempt) {
 			status.press_attempt=false;
 			status.pressing_button=0;
+			status.hovering=false;
+			update();
+		} else if (status.hovering) {
+			status.hovering=false;
 			update();
 		}
 	}