mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 08:17:34 -04:00
fix WorldCanvas scale animation
This commit is contained in:
parent
3a77eb7a3d
commit
8c726d4033
2 changed files with 4 additions and 6 deletions
|
@ -300,12 +300,11 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme_override_constants/separation = 0
|
theme_override_constants/separation = 0
|
||||||
|
|
||||||
[node name="WorldCanvas" type="Control" parent="HBoxContainer" node_paths=PackedStringArray("render_result")]
|
[node name="WorldCanvas" type="Control" parent="HBoxContainer"]
|
||||||
custom_minimum_size = Vector2(1300, 0)
|
custom_minimum_size = Vector2(1300, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 0
|
||||||
script = ExtResource("9_ncfxj")
|
script = ExtResource("9_ncfxj")
|
||||||
render_result = NodePath("RenderResult")
|
|
||||||
|
|
||||||
[node name="RenderResult" type="TextureRect" parent="HBoxContainer/WorldCanvas"]
|
[node name="RenderResult" type="TextureRect" parent="HBoxContainer/WorldCanvas"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
@export var render_result: RenderResult
|
|
||||||
@export var interpolate: float:
|
@export var interpolate: float:
|
||||||
set(value):
|
set(value):
|
||||||
interpolate = value
|
interpolate = value
|
||||||
animate(value)
|
animate(value)
|
||||||
|
|
||||||
var initial: int = 1300
|
var initial: int
|
||||||
var full_screen: int = 1920
|
var full_screen: int
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
var viewport_width = ProjectSettings.get_setting("display/window/size/viewport_width", 1152)
|
var viewport_width = ProjectSettings.get_setting("display/window/size/viewport_width", 1152)
|
||||||
var scale_width = float(custom_minimum_size.x) / viewport_width
|
var scale_width = float(custom_minimum_size.x) / viewport_width
|
||||||
|
|
||||||
full_screen = render_result.width
|
full_screen = int(get_parent_control().size.x)
|
||||||
initial = int(full_screen * scale_width)
|
initial = int(full_screen * scale_width)
|
||||||
custom_minimum_size.x = initial
|
custom_minimum_size.x = initial
|
||||||
Debug.logclr("WorldCanvas initial: %d full_screen: %d" % [initial, full_screen], Color.DIM_GRAY)
|
Debug.logclr("WorldCanvas initial: %d full_screen: %d" % [initial, full_screen], Color.DIM_GRAY)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue