fix #162 catch input events when they have been processed by the board
This commit is contained in:
parent
96e799f73e
commit
90a836fa23
|
|
@ -329,17 +329,19 @@ func insert_area(parent: Control, node: Area2D):
|
||||||
# Takes the inputs for control inputs
|
# Takes the inputs for control inputs
|
||||||
func _input(event):
|
func _input(event):
|
||||||
|
|
||||||
if event.is_action_pressed("ui_cancel"):
|
|
||||||
State.leave_stage(self)
|
|
||||||
|
|
||||||
# Return, if the input is a mouse event (mouse events are handled separately)
|
# Return, if the input is a mouse event (mouse events are handled separately)
|
||||||
if not has_stage or not is_instance_valid(currently_active_node): return
|
if not has_stage or not is_instance_valid(currently_active_node): return
|
||||||
|
|
||||||
|
if event.is_action_pressed("ui_cancel"):
|
||||||
|
State.leave_stage(self)
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
if event is InputEventMouse:
|
if event is InputEventMouse:
|
||||||
# makes sure to pass release events so notes do not get attached to the mouse while the cursor leaves the area.
|
# makes sure to pass release events so notes do not get attached to the mouse while the cursor leaves the area.
|
||||||
if event is InputEventMouseButton and current_context == DRAG:
|
if event is InputEventMouseButton and current_context == DRAG:
|
||||||
if event.button_index == MOUSE_BUTTON_LEFT and not event.pressed:
|
if event.button_index == MOUSE_BUTTON_LEFT and not event.pressed:
|
||||||
handle_mouse_button(event)
|
handle_mouse_button(event)
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -349,19 +351,22 @@ func _input(event):
|
||||||
current_sticky_note_id -= 1
|
current_sticky_note_id -= 1
|
||||||
else:
|
else:
|
||||||
current_dropzone_id -= 1
|
current_dropzone_id -= 1
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
elif event.is_action_pressed("ui_down"): # down to select an element beneath
|
elif event.is_action_pressed("ui_down"): # down to select an element beneath
|
||||||
if focus_stickies:
|
if focus_stickies:
|
||||||
current_sticky_note_id += 1
|
current_sticky_note_id += 1
|
||||||
else:
|
else:
|
||||||
current_dropzone_id += 1
|
current_dropzone_id += 1
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
elif event.is_action_pressed("ui_right"): # left to switch context to the left
|
elif event.is_action_pressed("ui_right"): # left to switch context to the left
|
||||||
if not focus_stickies:
|
if not focus_stickies:
|
||||||
if current_context == NAVIGATE:
|
if current_context == NAVIGATE:
|
||||||
focus_stickies = true
|
focus_stickies = true
|
||||||
elif current_context == ASSIGN:
|
elif current_context == ASSIGN:
|
||||||
current_context = NAVIGATE
|
current_context = NAVIGATE
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
elif event.is_action_pressed("ui_left"): # right to switch context to the right
|
elif event.is_action_pressed("ui_left"): # right to switch context to the right
|
||||||
if focus_stickies:
|
if focus_stickies:
|
||||||
|
|
@ -369,6 +374,7 @@ func _input(event):
|
||||||
focus_stickies = false
|
focus_stickies = false
|
||||||
elif current_context == ASSIGN:
|
elif current_context == ASSIGN:
|
||||||
current_context = NAVIGATE
|
current_context = NAVIGATE
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
elif event.is_action_pressed("ui_accept"): # select the selected note it
|
elif event.is_action_pressed("ui_accept"): # select the selected note it
|
||||||
if dropzone.get_child(current_dropzone_id) is Card:
|
if dropzone.get_child(current_dropzone_id) is Card:
|
||||||
|
|
@ -404,6 +410,7 @@ func _input(event):
|
||||||
current_dropzone_id += 1
|
current_dropzone_id += 1
|
||||||
currently_active_node.is_dragable = false
|
currently_active_node.is_dragable = false
|
||||||
currently_active_node.z_index = 1
|
currently_active_node.z_index = 1
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
# move the note it so it floats next to the card where it should be attached
|
# move the note it so it floats next to the card where it should be attached
|
||||||
func _select_card_for_assigning(sticky_note: Area2D, card: Area2D):
|
func _select_card_for_assigning(sticky_note: Area2D, card: Area2D):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue