summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2017-10-16 20:53:02 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2017-10-16 20:59:25 +0200
commit807a84f7c9aac49d2fd1f9c46693e0918f99c553 (patch)
tree9e73911dbc7208cdfce1ac0ba4699e3a5c1addcc
parent8de1dc7e9a1d137d9904122e775c270b03f4e049 (diff)
Reset slider mouse state on hiding/removing
Resetting `grab.active`, but also `mouse_inside` so that after reappearing it must be hovered again -even if the mouse is still over it- in order to get a highlight. That is consistent to the way other controls in the engine, e.g. buttons, work. Fixes #12130.
-rw-r--r--scene/gui/slider.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 116e0ac354..e88742a3e3 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -157,6 +157,12 @@ void Slider::_notification(int p_what) {
mouse_inside = false;
update();
} break;
+ case NOTIFICATION_VISIBILITY_CHANGED: // fallthrough
+ case NOTIFICATION_EXIT_TREE: {
+
+ mouse_inside = false;
+ grab.active = false;
+ } break;
case NOTIFICATION_DRAW: {
RID ci = get_canvas_item();
Size2i size = get_size();