From b43ed0e459704b92817908c6fed395e2ebb867d7 Mon Sep 17 00:00:00 2001 From: AleaJactaEst Date: Thu, 13 Jan 2022 00:37:17 +0100 Subject: [PATCH] correct issue input mouse --- .../interfaces/options/option_input_define.gd | 28 +++++++++++++++---- .../options/option_input_define.tscn | 4 +++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/scenes/interfaces/options/option_input_define.gd b/scenes/interfaces/options/option_input_define.gd index 20f40d8..49c25a3 100644 --- a/scenes/interfaces/options/option_input_define.gd +++ b/scenes/interfaces/options/option_input_define.gd @@ -4,7 +4,7 @@ var type_event = 0 var last_event = null var action = null var signalrefresh = null - +var activate_mouse_event = true func set_disabled(state:bool): $v/h_box_container/Ok.disabled = state @@ -17,6 +17,7 @@ func set_label(text: String): # Called when the node enters the scene tree for the first time. func _ready(): rect_min_size = Vector2(400,150) + activate_mouse_event = true set_disabled(true) func set_type_event(_action, event, _signalrefresh): @@ -44,10 +45,11 @@ func _input( event ): Config.msg_debug("InputEventJoypadMotion" + event.as_text () ) $v/result.text = event.as_text () elif event is InputEventMouseButton and self.type_event == 2: - last_event = event - Config.msg_debug("InputEventMouseButton" + Config.get_string_input_mousse_button(event)) - $v/result.text = Config.get_string_input_mousse_button(event) - #$v/result.text = event.action + if activate_mouse_event: + last_event = event + Config.msg_debug("InputEventMouseButton" + Config.get_string_input_mousse_button(event)) + $v/result.text = Config.get_string_input_mousse_button(event) + #$v/result.text = event.action elif event is InputEventMouseMotion and self.type_event == 3: last_event = event Config.msg_debug("InputEventMouseMotion" + event.as_text () ) @@ -73,3 +75,19 @@ func _on_Ok_pressed(): if self.signalrefresh != null: Config.msg_debug("Launch signal: ") self.signalrefresh.emit_signal_reload_control() + + +func _on_Cancel_mouse_entered(): + activate_mouse_event = false + + +func _on_Cancel_mouse_exited(): + activate_mouse_event = true + + +func _on_Ok_mouse_entered(): + activate_mouse_event = false + + +func _on_Ok_mouse_exited(): + activate_mouse_event = true diff --git a/scenes/interfaces/options/option_input_define.tscn b/scenes/interfaces/options/option_input_define.tscn index 1303237..e29e681 100644 --- a/scenes/interfaces/options/option_input_define.tscn +++ b/scenes/interfaces/options/option_input_define.tscn @@ -62,5 +62,9 @@ margin_bottom = 20.0 size_flags_horizontal = 3 text = "OK" +[connection signal="mouse_entered" from="v/h_box_container/Cancel" to="." method="_on_Cancel_mouse_entered"] +[connection signal="mouse_exited" from="v/h_box_container/Cancel" to="." method="_on_Cancel_mouse_exited"] [connection signal="pressed" from="v/h_box_container/Cancel" to="." method="_on_button_pressed"] +[connection signal="mouse_entered" from="v/h_box_container/Ok" to="." method="_on_Ok_mouse_entered"] +[connection signal="mouse_exited" from="v/h_box_container/Ok" to="." method="_on_Ok_mouse_exited"] [connection signal="pressed" from="v/h_box_container/Ok" to="." method="_on_Ok_pressed"]