Browse Source

added fix for search window scaling incorrectly

Jonathan Higgins 3 months ago
parent
commit
c3215c195f
2 changed files with 8 additions and 4 deletions
  1. 3 0
      scenes/main/scripts/control.gd
  2. 5 4
      scenes/menu/search_menu.gd

+ 3 - 0
scenes/main/scripts/control.gd

@@ -679,6 +679,9 @@ func _on_rich_text_label_meta_clicked(meta: Variant) -> void:
 func _on_graph_edit_popup_request(at_position: Vector2) -> void:
 
 	effect_position = graph_edit.get_local_mouse_position()
+	
+	#give the search menu the ui scale
+	$SearchMenu.uiscale = uiscale
 
 	#get the mouse position in screen coordinates
 	var mouse_screen_pos = DisplayServer.mouse_get_position()  

+ 5 - 4
scenes/menu/search_menu.gd

@@ -8,6 +8,7 @@ var replace_node = false
 var node_to_replace
 var connect_to_node = false
 var node_to_connect_to
+var uiscale
 signal make_node(command)
 signal swap_node(node_to_replace, command)
 signal connect_to_clicked_node(node_to_connect_to, command)
@@ -94,10 +95,10 @@ func display_items(filter: String):
 	
 	#resize menu within certain bounds #50
 	await get_tree().process_frame
-	if DisplayServer.screen_get_dpi(0) >= 144:
-		self.size.y = min((item_container.size.y + search_bar.size.y + 12) * 2, 820) #i think this will scale for retina screens but might be wrong
-	else:
-		self.size.y = min(item_container.size.y + search_bar.size.y + 12, 410)
+	#if DisplayServer.screen_get_dpi(0) >= 144:
+		#self.size.y = min((item_container.size.y + search_bar.size.y + 12) * 2, 820) #i think this will scale for retina screens but might be wrong
+	#else:
+	self.size.y = min((item_container.size.y + search_bar.size.y + 12) * uiscale, 410 * uiscale)
 	
 	#highlight first button
 	_on_search_bar_editing_toggled(true)