summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorMatthew Newall <matthewnewall@hotmail.com>2021-09-18 14:24:36 +0000
committerMatthew Newall <matthewnewall@hotmail.com>2021-09-26 17:05:44 +0000
commit082f9245668384d5bad79998dee40370c2d38dce (patch)
treeb7c9cb255451a763df2fcf32511f51e2579107a3 /scene
parentc77e1e28524abd22f2b60dbec72e21f4a9688bac (diff)
Updated Tabs to not update excessively
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/tabs.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 3ca2d1c1e9..8e580d9005 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -98,29 +98,45 @@ void Tabs::gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
Point2 pos = mm->get_position();
- highlight_arrow = -1;
if (buttons_visible) {
Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x < decr->get_width()) {
- highlight_arrow = 1;
+ if (highlight_arrow != 1) {
+ highlight_arrow = 1;
+ update();
+ }
} else if (pos.x < incr->get_width() + decr->get_width()) {
- highlight_arrow = 0;
+ if (highlight_arrow != 0) {
+ highlight_arrow = 0;
+ update();
+ }
+ } else if (highlight_arrow != -1) {
+ highlight_arrow = -1;
+ update();
}
} else {
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
if (pos.x > limit_minus_buttons + decr->get_width()) {
- highlight_arrow = 1;
+ if (highlight_arrow != 1) {
+ highlight_arrow = 1;
+ update();
+ }
} else if (pos.x > limit_minus_buttons) {
- highlight_arrow = 0;
+ if (highlight_arrow != 0) {
+ highlight_arrow = 0;
+ update();
+ }
+ } else if (highlight_arrow != -1) {
+ highlight_arrow = -1;
+ update();
}
}
}
_update_hover();
- update();
return;
}