2021-10-11 18:41:26 +02:00
|
|
|
tool
|
2021-10-11 05:10:22 +02:00
|
|
|
extends TabContainer
|
|
|
|
|
2021-10-11 18:41:26 +02:00
|
|
|
onready var editor:TextEditor = owner
|
|
|
|
|
2021-10-11 05:10:22 +02:00
|
|
|
var mouse:bool = false
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
var _e
|
|
|
|
_e = connect("mouse_entered", self, "set", ["mouse", true])
|
|
|
|
_e = connect("mouse_exited", self, "set", ["mouse", false])
|
|
|
|
|
|
|
|
func _input(e):
|
2021-10-11 18:41:26 +02:00
|
|
|
if not editor.is_plugin_active():
|
|
|
|
return
|
|
|
|
|
2021-10-11 05:10:22 +02:00
|
|
|
if mouse and e is InputEventMouseButton and e.pressed:
|
|
|
|
if e.button_index == BUTTON_WHEEL_DOWN:
|
|
|
|
prev()
|
|
|
|
get_tree().set_input_as_handled()
|
|
|
|
|
|
|
|
elif e.button_index == BUTTON_WHEEL_UP:
|
|
|
|
next()
|
|
|
|
get_tree().set_input_as_handled()
|
|
|
|
|
|
|
|
if e is InputEventKey and e.pressed and e.control and e.scancode == KEY_TAB:
|
|
|
|
if e.shift:
|
|
|
|
prev()
|
|
|
|
get_tree().set_input_as_handled()
|
|
|
|
else:
|
|
|
|
next()
|
|
|
|
get_tree().set_input_as_handled()
|
|
|
|
|
|
|
|
func prev(): current_tab = wrapi(current_tab - 1, 0, get_child_count())
|
|
|
|
func next(): current_tab = wrapi(current_tab + 1, 0, get_child_count())
|
|
|
|
|