Adds the option to fit the viewport to vertical screenspace (#27061)
* Adds the option to fit your viewport to your vertical screenspace * fixes documentation * Removes commented-out leftover * Hides the viewport width slider and also we dont know if the viewport width causing stretching/squishing was a bug present before but we fixed that while we were at it * Removes commented out leftovers
This commit is contained in:
@@ -25,6 +25,7 @@ public sealed class ViewportUIController : UIController
|
||||
_configurationManager.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportRatio());
|
||||
_configurationManager.OnValueChanged(CCVars.ViewportMaximumWidth, _ => UpdateViewportRatio());
|
||||
_configurationManager.OnValueChanged(CCVars.ViewportWidth, _ => UpdateViewportRatio());
|
||||
_configurationManager.OnValueChanged(CCVars.ViewportVerticalFit, _ => UpdateViewportRatio());
|
||||
|
||||
var gameplayStateLoad = UIManager.GetUIController<GameplayStateLoadController>();
|
||||
gameplayStateLoad.OnScreenLoad += OnScreenLoad;
|
||||
@@ -45,13 +46,19 @@ public sealed class ViewportUIController : UIController
|
||||
var min = _configurationManager.GetCVar(CCVars.ViewportMinimumWidth);
|
||||
var max = _configurationManager.GetCVar(CCVars.ViewportMaximumWidth);
|
||||
var width = _configurationManager.GetCVar(CCVars.ViewportWidth);
|
||||
var verticalfit = _configurationManager.GetCVar(CCVars.ViewportVerticalFit) && _configurationManager.GetCVar(CCVars.ViewportStretch);
|
||||
|
||||
if (width < min || width > max)
|
||||
if (verticalfit)
|
||||
{
|
||||
width = max;
|
||||
}
|
||||
else if (width < min || width > max)
|
||||
{
|
||||
width = CCVars.ViewportWidth.DefaultValue;
|
||||
}
|
||||
|
||||
Viewport.Viewport.ViewportSize = (EyeManager.PixelsPerMeter * width, EyeManager.PixelsPerMeter * ViewportHeight);
|
||||
Viewport.UpdateCfg();
|
||||
}
|
||||
|
||||
public void ReloadViewport()
|
||||
|
||||
Reference in New Issue
Block a user