unhardcode the middle scroll wheel
This commit is contained in:
@@ -62,20 +62,19 @@ func _process(_delta):
|
|||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
# make sure we are hovering over the tab
|
# make sure we are hovering over the tab
|
||||||
if mouse_over_tab:
|
if mouse_over_tab and event.is_action_pressed("CloseTabMouse"):
|
||||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_MIDDLE and event.pressed:
|
var close_tween = create_tween()
|
||||||
var close_tween = create_tween()
|
close_tween.set_ease(Tween.EASE_IN)
|
||||||
close_tween.set_ease(Tween.EASE_IN)
|
close_tween.set_trans(Tween.TRANS_CUBIC)
|
||||||
close_tween.set_trans(Tween.TRANS_CUBIC)
|
|
||||||
|
|
||||||
close_tween.parallel().tween_property(self, "custom_minimum_size:x", 0.0, 0.15)
|
close_tween.parallel().tween_property(self, "custom_minimum_size:x", 0.0, 0.15)
|
||||||
close_tween.parallel().tween_property(self, "size:x", 0.0, 0.15)
|
close_tween.parallel().tween_property(self, "size:x", 0.0, 0.15)
|
||||||
close_tween.parallel().tween_property(button, "custom_minimum_size:x", 0.0, 0.15)
|
close_tween.parallel().tween_property(button, "custom_minimum_size:x", 0.0, 0.15)
|
||||||
close_tween.parallel().tween_property(button, "size:x", 0.0, 0.15)
|
close_tween.parallel().tween_property(button, "size:x", 0.0, 0.15)
|
||||||
|
|
||||||
await close_tween.finished
|
await close_tween.finished
|
||||||
tab_closed.emit()
|
tab_closed.emit()
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
func set_title(title: String) -> void:
|
func set_title(title: String) -> void:
|
||||||
button.text = title
|
button.text = title
|
||||||
|
|||||||
@@ -85,3 +85,8 @@ ReloadPage={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
CloseTabMouse={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":4,"position":Vector2(134, 20),"global_position":Vector2(143, 68),"factor":1.0,"button_index":3,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user