Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements #2187

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func _on_Search_text_changed(new_text:String, just_update:bool = false) -> void:
%Suggestions.size.x = max(%PanelContainer.size.x, line_length)


func suggestion_selected(index : int, position:=Vector2(), button_index:=MOUSE_BUTTON_LEFT) -> void:
func suggestion_selected(index: int, position := Vector2(), button_index := MOUSE_BUTTON_LEFT) -> void:
if button_index != MOUSE_BUTTON_LEFT:
return
if %Suggestions.is_item_disabled(index):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var _initialized := false
################## TIMELINE EVENT MANAGEMENT ###################################
################################################################################
var selected_items : Array = []
var drag_allowed := false


#region CREATE/SAVE/LOAD
Expand Down Expand Up @@ -299,7 +300,7 @@ func update_content_list() -> void:
#################################################################################

# SIGNAL handles input on the events mainly for selection and moving events
func _on_event_block_gui_input(event, item: Node) -> void:
func _on_event_block_gui_input(event: InputEvent, item: Node) -> void:
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
if event.is_pressed():
if len(selected_items) > 1 and item in selected_items and !Input.is_key_pressed(KEY_CTRL):
Expand All @@ -309,9 +310,11 @@ func _on_event_block_gui_input(event, item: Node) -> void:
elif len(selected_items) > 1 or Input.is_key_pressed(KEY_CTRL):
select_item(item)

drag_allowed = true

if len(selected_items) > 0 and event is InputEventMouseMotion:
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
if !%TimelineArea.dragging and !get_viewport().gui_is_dragging():
if !%TimelineArea.dragging and !get_viewport().gui_is_dragging() and drag_allowed:
sort_selection()
%TimelineArea.start_dragging(%TimelineArea.DragTypes.EXISTING_EVENTS, selected_items)

Expand Down Expand Up @@ -835,8 +838,8 @@ func offset_blocks_by_index(blocks:Array, offset:int):

func scroll_to_piece(piece_index:int) -> void:
await get_tree().process_frame
var height :float = %Timeline.get_child(min(piece_index, %Timeline.get_child_count()-1)).position.y
if height < %TimelineArea.scroll_vertical or height > %TimelineArea.scroll_vertical+%TimelineArea.size.y-(200*DialogicUtil.get_editor_scale()):
var height: float = %Timeline.get_child(min(piece_index, %Timeline.get_child_count()-1)).position.y
if height < %TimelineArea.scroll_vertical or height > %TimelineArea.scroll_vertical+%TimelineArea.size.y:
%TimelineArea.scroll_vertical = height


Expand Down Expand Up @@ -996,15 +999,20 @@ func duplicate_selected() -> void:


func _input(event:InputEvent) -> void:
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed == false:
drag_allowed = false

# we protect this with is_visible_in_tree to not
# invoke a shortcut by accident
if !((event is InputEventKey or !event is InputEventWithModifiers) and is_visible_in_tree()):
return


if "pressed" in event:
if !event.pressed:
return


## Some shortcuts should always work
match event.as_text():
"Ctrl+T": # Add text event
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Text/settings_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func _get_title() -> String:
func _refresh() -> void:
%DefaultSpeed.value = ProjectSettings.get_setting('dialogic/text/letter_speed', 0.01)
%Skippable.button_pressed = ProjectSettings.get_setting('dialogic/text/initial_text_reveal_skippable', true)
%SkippableDelay.value = ProjectSettings.get_setting('dialogic/text/skippable_delay', 0.1)
%SkippableDelay.value = ProjectSettings.get_setting('dialogic/text/text_reveal_skip_delay', 0.1)

%AutoAdvance.button_pressed = ProjectSettings.get_setting('dialogic/text/autoadvance_enabled', false)
%FixedDelay.value = ProjectSettings.get_setting('dialogic/text/autoadvance_fixed_delay', 1)
Expand Down
Loading