Skip to content

Commit 628e6ba

Browse files
authored
TextBubble Style: Adds mouse filter setting (#2562)
By allowing the user to change the mouse filter, the bubble can now be set to ignore to prevent it from capturing events. The original use case for this modification was preventing bubbles of blocking the mouse movement when the mouse was captured on a 3D game.
1 parent 0edd934 commit 628e6ba

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

addons/dialogic/Modules/DefaultLayoutParts/Layer_Textbubble/text_bubble.gd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,11 @@ func get_speaker_canvas_position() -> Vector2:
200200
if node_to_point_at is CanvasItem:
201201
base_position = (node_to_point_at as CanvasItem).get_global_transform_with_canvas().origin
202202
return base_position
203+
204+
205+
## Changes the property of mouse filter of the bubble and its children (text and label).
206+
func change_mouse_filter(mouse_filter: Control.MouseFilter) -> void:
207+
mouse_filter = mouse_filter
208+
text.mouse_filter = mouse_filter
209+
name_label_box.mouse_filter = mouse_filter
210+
name_label_holder.mouse_filter = mouse_filter

addons/dialogic/Modules/DefaultLayoutParts/Layer_Textbubble/text_bubble_layer.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extends DialogicLayoutLayer
2525
@export_subgroup('Behaviour')
2626
@export var behaviour_distance: int = 50
2727
@export var behaviour_direction: Vector2 = Vector2(1, -1)
28+
@export var behaviour_mouse_filter: Control.MouseFilter
2829

2930
@export_group('Name Label')
3031
@export_subgroup("Name Label")
@@ -118,6 +119,7 @@ func bubble_apply_overrides(bubble:TextBubble) -> void:
118119
## BEHAVIOUR
119120
bubble.safe_zone = behaviour_distance
120121
bubble.base_direction = behaviour_direction
122+
bubble.change_mouse_filter(behaviour_mouse_filter)
121123

122124

123125
## NAME LABEL SETTINGS

0 commit comments

Comments
 (0)