mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Add a set_display_scale()
method to Main to avoid duplicate code
This commit is contained in:
parent
ec17e970e0
commit
d2892358e3
18
src/Main.gd
18
src/Main.gd
|
@ -250,16 +250,10 @@ func _handle_layout_files() -> void:
|
|||
func _setup_application_window_size() -> void:
|
||||
if DisplayServer.get_name() == "headless":
|
||||
return
|
||||
var root := get_tree().root
|
||||
root.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_IGNORE
|
||||
root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED
|
||||
# Set a minimum window size to prevent UI elements from collapsing on each other.
|
||||
root.min_size = Vector2(1024, 576)
|
||||
root.content_scale_factor = Global.shrink
|
||||
set_display_scale()
|
||||
if Global.font_size != theme.default_font_size:
|
||||
theme.default_font_size = Global.font_size
|
||||
theme.set_font_size("font_size", "HeaderSmall", Global.font_size + 2)
|
||||
set_custom_cursor()
|
||||
|
||||
if OS.get_name() == "Web":
|
||||
return
|
||||
|
@ -280,6 +274,16 @@ func _setup_application_window_size() -> void:
|
|||
get_window().size = Global.config_cache.get_value("window", "size")
|
||||
|
||||
|
||||
func set_display_scale() -> void:
|
||||
var root := get_window()
|
||||
root.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_IGNORE
|
||||
root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED
|
||||
# Set a minimum window size to prevent UI elements from collapsing on each other.
|
||||
root.min_size = Vector2(1024, 576)
|
||||
root.content_scale_factor = Global.shrink
|
||||
set_custom_cursor()
|
||||
|
||||
|
||||
func set_custom_cursor() -> void:
|
||||
if Global.native_cursors:
|
||||
return
|
||||
|
|
|
@ -413,12 +413,7 @@ func _on_List_item_selected(index: int) -> void:
|
|||
|
||||
|
||||
func _on_shrink_apply_button_pressed() -> void:
|
||||
var root := get_tree().root
|
||||
root.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_IGNORE
|
||||
root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED
|
||||
root.min_size = Vector2(1024, 576)
|
||||
root.content_scale_factor = Global.shrink
|
||||
Global.control.set_custom_cursor()
|
||||
Global.control.set_display_scale()
|
||||
hide()
|
||||
popup_centered(Vector2(600, 400))
|
||||
Global.dialog_open(true)
|
||||
|
|
|
@ -99,6 +99,7 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
# Workaround for https://github.com/Orama-Interactive/Pixelorama/issues/1070
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
file_menu.activate_item_by_event(event)
|
||||
edit_menu.activate_item_by_event(event)
|
||||
|
|
Loading…
Reference in a new issue