Skip to content

Fix content_scale_* updates: properties are in Window not (Sub-)Viewport #1184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gui/multiple_resolutions/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ func _on_window_base_size_item_selected(index: int) -> void:
7: # 1680×720 (21:9)
base_window_size = Vector2(1680, 720)

get_viewport().content_scale_size = base_window_size
get_window().content_scale_size = base_window_size
update_container.call_deferred()


func _on_window_stretch_mode_item_selected(index: int) -> void:
stretch_mode = index as Window.ContentScaleMode
get_viewport().content_scale_mode = stretch_mode
get_window().content_scale_mode = stretch_mode

# Disable irrelevant options when the stretch mode is Disabled.
$"Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowBaseSize/OptionButton".disabled = stretch_mode == Window.CONTENT_SCALE_MODE_DISABLED
Expand All @@ -121,14 +121,14 @@ func _on_window_stretch_mode_item_selected(index: int) -> void:

func _on_window_stretch_aspect_item_selected(index: int) -> void:
stretch_aspect = index as Window.ContentScaleAspect
get_viewport().content_scale_aspect = stretch_aspect
get_window().content_scale_aspect = stretch_aspect


func _on_window_scale_factor_drag_ended(_value_changed: bool) -> void:
scale_factor = $"Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor/HSlider".value
$"Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor/Value".text = "%d%%" % (scale_factor * 100)
get_viewport().content_scale_factor = scale_factor
get_window().content_scale_factor = scale_factor


func _on_window_stretch_scale_mode_item_selected(index: int) -> void:
get_viewport().content_scale_stretch = index
get_window().content_scale_stretch = index