Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jowan-Spooner committed Jan 9, 2024
1 parent ff75d02 commit 91e2e0c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 6 additions & 2 deletions addons/dialogic/Editor/Events/Fields/field_file.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var resource_icon:Texture:
else:
%Field.theme_type_variation = "LineEditWithIcon"

var max_text_length := 16
var max_width := 200
var current_value : String
var hide_reset:bool = false

Expand Down Expand Up @@ -59,8 +59,12 @@ func _set_value(value:Variant) -> void:
if file_mode != EditorFileDialog.FILE_MODE_OPEN_DIR:
text = value.get_file()
%Field.tooltip_text = value
if len(text) > max_text_length:

if %Field.get_theme_font('font').get_string_size(
text, 0, -1,
%Field.get_theme_font_size('font_size')).x > max_width:
%Field.expand_to_text_length = false
%Field.custom_minimum_size.x = max_width
%Field.size.x = 0
else:
%Field.custom_minimum_size.x = 0
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Editor/Events/Fields/field_file.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ border_width_bottom = 2
corner_detail = 1

[node name="Field_File" type="MarginContainer"]
offset_right = 160.0
offset_right = 314.0
offset_bottom = 40.0
theme_type_variation = &"DialogicEventEdit"
script = ExtResource("1_0grcf")
Expand Down
6 changes: 0 additions & 6 deletions addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ extends DialogicVisualEditorField
@export var empty_text := ""
enum Modes {PURE_STRING, PRETTY_PATH, IDENTIFIER}
@export var mode := Modes.PURE_STRING

#@export var enable_pretty_name := false
@export var fit_text_length := true
var collapse_when_empty := false
var valid_file_drop_extension := ""
Expand Down Expand Up @@ -158,10 +156,6 @@ func suggestion_selected(index : int, position:=Vector2(), button_index:=MOUSE_B
if %Suggestions.get_item_metadata(index) == null:
current_value = ""

## if this is a resource, then load it instead of assigning the string:
#elif file_extension != "" and file_extension != ".dch" and file_extension != ".dtl":
#var file = load(%Suggestions.get_item_metadata(index))
#current_value = file
else:
current_value = %Suggestions.get_item_metadata(index)

Expand Down

0 comments on commit 91e2e0c

Please sign in to comment.