Open svn133 opened 5 months ago
In case this is not clear from the description: this affects both Controls and other non-UI 2D nodes.. I just used Control elements in the demonstration to keep it simple.
The GUI tag part is for the window behaviour itself, more than the elements scaling, as the behaviour is likely related to the way it handles the viewport itself
Tested versions
System information
Godot v4.2.2.stable - macOS 13.5.0 - GLES3 (Compatibility) - Intel(R) Iris(TM) Plus Graphics OpenGL Engine - Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz (8 Threads)
Issue description
I try to achieve the following configuration for my project:
I tried to achieve this with the following configuration
The combination "expand" with "integer" should lead to the desired behaviour, but it is not actually doing so in most window-sizings.
When using scale mode "fractional" instead, I get the basic desired behaviour for content-filling/expansion, only the content-scaling is not "stepping" in that variant.
Observed behaviour (vs. expected)
onle resizing horizontally
only resizing vertically
resizing both directions simultanously
Remarks on behaviour
When comparing the observed behaviour with the behaviour of the same configuration but using "fractional" for scale mode, I hav the impression that this is bugged (or at least inconsistent).
When resizing in both directions at the same time, I expected this configuration to behave basically exactly like for scaling mode "fractional" (i.e., no black borders), with exception that the content scaling is happening in a stepped way.
I'm not sure if the current behaviour is actually desired as is, or if this really is a bug. At least for me, it feels like a bug (or at minimum very inconsistent in comparision with "fractional" behaviour).
I hope the attached visualizations clarify the expected vs. actual behaviour for this.
Here are some places I saw similar (or almost similar) behaviour as desired/expected for this combination:
https://github.com/godotengine/godot-proposals/issues/1666
https://www.reddit.com/r/godot/comments/18ll9cp/integer_scale_mode_expand_without_black_bars/
This seems to be the problematic code, I'm noticing an xor/branching for "expand vertically" vs "expand horizontally" which is likely the origin of the behaviour...?
https://github.com/godotengine/godot/blob/master/scene/main/window.cpp#L1056
A short video where I demonstrate the behaviour first with "integer" mode and then with "fractional" mode. Both "should" almost look the same, except for the stepped content-scaling, but they differ extemely.
https://github.com/godotengine/godot/assets/114500633/7081ab30-35c0-44e3-836a-16f45ca45398
Steps to reproduce
(or just use attached example project)
Minimal reproduction project (MRP)
unexpected-integer-scaling-project.zip