menu navigation done

This commit is contained in:
Nordup 2023-06-20 10:24:18 +04:00
parent c2e194d922
commit a82a27b38f
3 changed files with 22 additions and 13 deletions

View file

@ -241,7 +241,7 @@ focus_neighbor_right = NodePath("")
focus_neighbor_bottom = NodePath("")
focus_next = NodePath("")
focus_previous = NodePath("")
focus_mode = 2
focus_mode = 0
mouse_filter = 0
mouse_force_pass_scroll_events = true
mouse_default_cursor_shape = 2
@ -310,7 +310,7 @@ focus_neighbor_right = NodePath("")
focus_neighbor_bottom = NodePath("")
focus_next = NodePath("")
focus_previous = NodePath("")
focus_mode = 2
focus_mode = 0
mouse_filter = 0
mouse_force_pass_scroll_events = true
mouse_default_cursor_shape = 2
@ -377,7 +377,7 @@ focus_neighbor_right = NodePath("")
focus_neighbor_bottom = NodePath("")
focus_next = NodePath("")
focus_previous = NodePath("")
focus_mode = 2
focus_mode = 0
mouse_filter = 0
mouse_force_pass_scroll_events = true
mouse_default_cursor_shape = 2
@ -449,7 +449,7 @@ focus_neighbor_right = NodePath("")
focus_neighbor_bottom = NodePath("")
focus_next = NodePath("")
focus_previous = NodePath("")
focus_mode = 2
focus_mode = 0
mouse_filter = 0
mouse_force_pass_scroll_events = true
mouse_default_cursor_shape = 2
@ -530,7 +530,7 @@ focus_neighbor_right = NodePath("")
focus_neighbor_bottom = NodePath("")
focus_next = NodePath("")
focus_previous = NodePath("")
focus_mode = 2
focus_mode = 0
mouse_filter = 0
mouse_force_pass_scroll_events = true
mouse_default_cursor_shape = 2

View file

@ -24,18 +24,18 @@ func add(url: String) -> void:
index += 1
history.resize(index)
history.push_back(url)
print(str(history) + " " + str(index))
print_history()
func forw() -> String:
index += 1
print(str(history) + " " + str(index))
print_history()
return history[index]
func back() -> String:
index -= 1
print(str(history) + " " + str(index))
print_history()
if index == -1:
return ""
return history[index]
@ -44,4 +44,8 @@ func back() -> String:
func clear() -> void:
index = -1
history.clear()
print(str(history) + " " + str(index))
print_history()
func print_history() -> void:
Debug.logclr("History: " + str(history) + " Current: " + str(index), Color.DIM_GRAY)

View file

@ -23,15 +23,19 @@ func _ready() -> void:
func on_open_gate(url: String) -> void:
history.add(url)
enable([go_back, reload, home])
if not history.can_forw():
disable([go_forw])
func on_go_back() -> void:
var url = history.back()
if url == "":
on_home()
else:
gate_events.open_gate_emit(url)
enable([go_forw])
if history.can_back():
gate_events.open_gate_emit(url)
else:
disable([go_back, reload, home])
gate_events.exit_gate_emit()
func on_go_forw() -> void:
@ -49,6 +53,7 @@ func on_reload() -> void:
func on_home() -> void:
history.clear()
disable([go_back, go_forw, reload, home])
gate_events.exit_gate_emit()