From d3cb0c2b177de66a75d29d8dcdad69dac9e21ea1 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 22 Jul 2020 00:11:33 +0300 Subject: [PATCH] Gave splash screen and camera_zoom() more time to get executed This should make the splash screen properly centered on HTML5, and the canvas being always fit to frame when the program starts (in all platforms). --- src/Canvas.gd | 1 + src/Main.gd | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Canvas.gd b/src/Canvas.gd index ec8cab003..593ba31f7 100644 --- a/src/Canvas.gd +++ b/src/Canvas.gd @@ -14,6 +14,7 @@ var sprite_changed_this_frame := false # for optimization purposes func _ready() -> void: var frame : Frame = new_empty_frame(true) Global.current_project.frames.append(frame) + yield(get_tree().create_timer(0.2), "timeout") camera_zoom() diff --git a/src/Main.gd b/src/Main.gd index 0b36d89df..259917c3e 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -59,6 +59,8 @@ func _input(event : InputEvent) -> void: func setup_application_window_size() -> void: + if OS.get_name() == "HTML5": + return # Set a minimum window size to prevent UI elements from collapsing on each other. OS.min_window_size = Vector2(1024, 576) @@ -77,7 +79,7 @@ func setup_application_window_size() -> void: func show_splash_screen() -> void: # Wait for the window to adjust itself, so the popup is correctly centered - yield(get_tree().create_timer(0.01), "timeout") + yield(get_tree().create_timer(0.2), "timeout") if Global.config_cache.get_value("preferences", "startup"): $Dialogs/SplashDialog.popup_centered() # Splash screen modulate = Color(0.5, 0.5, 0.5)