correct issue input mouse

This commit is contained in:
AleaJactaEst 2022-01-13 00:37:17 +01:00
parent 326a5f5a0d
commit b43ed0e459
2 changed files with 27 additions and 5 deletions

View file

@ -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

View file

@ -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"]