Quellcode durchsuchen

Updated Tabs to not update excessively

(cherry picked from commit 082f9245668384d5bad79998dee40370c2d38dce)
Matthew Newall vor 4 Jahren
Ursprung
Commit
e01d609c02
1 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen
  1. 11 4
      scene/gui/tabs.cpp

+ 11 - 4
scene/gui/tabs.cpp

@@ -89,7 +89,6 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
 	if (mm.is_valid()) {
 	if (mm.is_valid()) {
 		Point2 pos = mm->get_position();
 		Point2 pos = mm->get_position();
 
 
-		highlight_arrow = -1;
 		if (buttons_visible) {
 		if (buttons_visible) {
 			Ref<Texture> incr = get_icon("increment");
 			Ref<Texture> incr = get_icon("increment");
 			Ref<Texture> decr = get_icon("decrement");
 			Ref<Texture> decr = get_icon("decrement");
@@ -97,14 +96,22 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
 			int limit = get_size().width - incr->get_width() - decr->get_width();
 			int limit = get_size().width - incr->get_width() - decr->get_width();
 
 
 			if (pos.x > limit + decr->get_width()) {
 			if (pos.x > limit + decr->get_width()) {
-				highlight_arrow = 1;
+				if (highlight_arrow != 1) {
+					highlight_arrow = 1;
+					update();
+				}
 			} else if (pos.x > limit) {
 			} else if (pos.x > limit) {
-				highlight_arrow = 0;
+				if (highlight_arrow != 0) {
+					highlight_arrow = 0;
+					update();
+				}
+			} else if (highlight_arrow != -1) {
+				highlight_arrow = -1;
+				update();
 			}
 			}
 		}
 		}
 
 
 		_update_hover();
 		_update_hover();
-		update();
 		return;
 		return;
 	}
 	}