From 6801623886dd7edc298ca9fdb1fdae760572dc19 Mon Sep 17 00:00:00 2001 From: weeniemount <59868100+weeniemount@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:57:57 +0200 Subject: [PATCH 1/3] Update Tab.gd --- flumi/Scripts/Browser/Tab.gd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/flumi/Scripts/Browser/Tab.gd b/flumi/Scripts/Browser/Tab.gd index 2a58f02..9c1c68f 100644 --- a/flumi/Scripts/Browser/Tab.gd +++ b/flumi/Scripts/Browser/Tab.gd @@ -60,6 +60,23 @@ func _process(_delta): else: close_button.add_theme_stylebox_override("normal", CLOSE_BUTTON_NORMAL) +func _input(event): + # make sure we are hovering over the tab + if mouse_over_tab: + if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_MIDDLE and event.pressed: + var close_tween = create_tween() + close_tween.set_ease(Tween.EASE_IN) + 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, "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) + + await close_tween.finished + tab_closed.emit() + queue_free() + func set_title(title: String) -> void: button.text = title button.set_meta("original_text", title) From 5dc7721d9c9959189d5274c4349c06e1b426f89b Mon Sep 17 00:00:00 2001 From: weeniemount <59868100+weeniemount@users.noreply.github.com> Date: Wed, 10 Sep 2025 19:52:49 +0200 Subject: [PATCH 2/3] unhardcode the middle scroll wheel --- flumi/Scripts/Browser/Tab.gd | 27 +++++++++++++-------------- flumi/project.godot | 5 +++++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/flumi/Scripts/Browser/Tab.gd b/flumi/Scripts/Browser/Tab.gd index f6e8d4f..6f7ac79 100644 --- a/flumi/Scripts/Browser/Tab.gd +++ b/flumi/Scripts/Browser/Tab.gd @@ -62,20 +62,19 @@ func _process(_delta): func _input(event): # make sure we are hovering over the tab - if mouse_over_tab: - if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_MIDDLE and event.pressed: - var close_tween = create_tween() - close_tween.set_ease(Tween.EASE_IN) - 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, "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) - - await close_tween.finished - tab_closed.emit() - queue_free() + if mouse_over_tab and event.is_action_pressed("CloseTabMouse"): + var close_tween = create_tween() + close_tween.set_ease(Tween.EASE_IN) + 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, "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) + + await close_tween.finished + tab_closed.emit() + queue_free() func set_title(title: String) -> void: button.text = title diff --git a/flumi/project.godot b/flumi/project.godot index 6dd1a5c..eceb340 100644 --- a/flumi/project.godot +++ b/flumi/project.godot @@ -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) ] } +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) +] +} From 4b54e6cce896828e400e42bc7fdc9850df788fd0 Mon Sep 17 00:00:00 2001 From: Face <69168154+face-hh@users.noreply.github.com> Date: Thu, 25 Sep 2025 19:40:02 +0300 Subject: [PATCH 3/3] extract duplicated code into a function --- flumi/Scripts/Browser/Tab.gd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/flumi/Scripts/Browser/Tab.gd b/flumi/Scripts/Browser/Tab.gd index 6f7ac79..e454201 100644 --- a/flumi/Scripts/Browser/Tab.gd +++ b/flumi/Scripts/Browser/Tab.gd @@ -67,15 +67,18 @@ func _input(event): close_tween.set_ease(Tween.EASE_IN) 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, "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) + animate_tab_close(close_tween) await close_tween.finished tab_closed.emit() queue_free() +func animate_tab_close(tween: Tween) -> void: + tween.parallel().tween_property(self, "custom_minimum_size:x", 0.0, 0.15) + tween.parallel().tween_property(self, "size:x", 0.0, 0.15) + tween.parallel().tween_property(button, "custom_minimum_size:x", 0.0, 0.15) + tween.parallel().tween_property(button, "size:x", 0.0, 0.15) + func set_title(title: String) -> void: button.text = title button.set_meta("original_text", title) @@ -247,10 +250,7 @@ func _on_close_button_pressed() -> void: close_tween.set_ease(Tween.EASE_IN) 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, "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) + animate_tab_close(close_tween) await close_tween.finished tab_closed.emit()