Add tabbing
This commit is contained in:
@@ -146,6 +146,18 @@ camera_orbit_down={
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
tab_prev={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
tab_next={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_accept={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
|
||||
@@ -17,6 +17,16 @@ func _notification(what:int) -> void:
|
||||
if what == NOTIFICATION_VISIBILITY_CHANGED and visible:
|
||||
tabs.grab_focus()
|
||||
|
||||
func _input(event:InputEvent) -> void:
|
||||
if !is_visible_in_tree():
|
||||
return
|
||||
if event.is_action_pressed("tab_next"):
|
||||
tabs.current_tab = (tabs.current_tab + 1) % tabs.tab_count
|
||||
get_viewport().set_input_as_handled()
|
||||
elif event.is_action_pressed("tab_prev"):
|
||||
tabs.current_tab = (tabs.current_tab - 1 + tabs.tab_count) % tabs.tab_count
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func onTabChanged(tabIndex:int) -> void:
|
||||
for control in tabControls:
|
||||
control.visible = false
|
||||
|
||||
Reference in New Issue
Block a user