Skip to content

Commit 27104ab

Browse files
authored
Fix content_scale_* updates: properties are in Window not (Sub-)Viewport
While the demo seems to work, the editor won't allow the user to jump to the docs when using Ctrl+LMB
1 parent fad2469 commit 27104ab

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

gui/multiple_resolutions/main.gd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ func _on_window_base_size_item_selected(index: int) -> void:
106106
7: # 1680×720 (21:9)
107107
base_window_size = Vector2(1680, 720)
108108

109-
get_viewport().content_scale_size = base_window_size
109+
get_window().content_scale_size = base_window_size
110110
update_container.call_deferred()
111111

112112

113113
func _on_window_stretch_mode_item_selected(index: int) -> void:
114114
stretch_mode = index as Window.ContentScaleMode
115-
get_viewport().content_scale_mode = stretch_mode
115+
get_window().content_scale_mode = stretch_mode
116116

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

122122
func _on_window_stretch_aspect_item_selected(index: int) -> void:
123123
stretch_aspect = index as Window.ContentScaleAspect
124-
get_viewport().content_scale_aspect = stretch_aspect
124+
get_window().content_scale_aspect = stretch_aspect
125125

126126

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

132132

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

0 commit comments

Comments
 (0)