Skip to content

Commit

Permalink
Attempt at fixing suggestion width on hdpi (dialogic-godot#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jowan-Spooner committed Feb 6, 2024
1 parent 5e8c3ca commit 82f915d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd
Original file line number Diff line number Diff line change
@@ -119,7 +119,11 @@ func _on_Search_text_changed(new_text:String, just_update:bool = false) -> void:
var idx: int = 0
for element in suggestions:
if new_text.is_empty() or new_text.to_lower() in element.to_lower() or new_text.to_lower() in str(suggestions[element].value).to_lower() or new_text.to_lower() in suggestions[element].get('tooltip', '').to_lower():
line_length = max(get_theme_font('font', 'Label').get_string_size(element, HORIZONTAL_ALIGNMENT_LEFT, -1, get_theme_font_size("font_size", 'Label')).x+80, line_length)
line_length = max(
get_theme_font('font', 'Label').get_string_size(
element, HORIZONTAL_ALIGNMENT_LEFT, -1, get_theme_font_size("font_size", 'Label')
).x + (80 * DialogicUtil.get_editor_scale()),
line_length)
%Suggestions.add_item(element)
if suggestions[element].has('icon'):
%Suggestions.set_item_icon(idx, suggestions[element].icon)
@@ -133,7 +137,7 @@ func _on_Search_text_changed(new_text:String, just_update:bool = false) -> void:
if not %Suggestions.visible:
%Suggestions.show()
%Suggestions.global_position = $PanelContainer.global_position+Vector2(0,1)*$PanelContainer.size.y
%Suggestions.size.x = max(%Search.size.x, line_length)
%Suggestions.size.x = max(%PanelContainer.size.x, line_length)
%Suggestions.size.y = min(%Suggestions.get_item_count()*35*DialogicUtil.get_editor_scale(), 200*DialogicUtil.get_editor_scale())

if %Suggestions.get_item_count():

0 comments on commit 82f915d

Please sign in to comment.