mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-11-19 13:17:10 +00:00
increase localsettings scroller bounds
This commit is contained in:
1 parent
5f6ac17e52
commit
6deaae350e
1 file changed
+8
-2
@@ -118,11 +118,13 @@ public abstract class LocalSettingsTab(ConfigFile config)
|
||||
tab.transform.DestroyChildren();
|
||||
tab.gameObject.SetActive(false);
|
||||
|
||||
if (Scroller == null)
|
||||
if (Scroller == null || Scroller.transform.parent != tab.transform)
|
||||
{
|
||||
Scroller = Helpers.CreateScroller(tab.transform, OptionsMenuPatches.MaskCollider);
|
||||
}
|
||||
|
||||
Labels.Clear();
|
||||
|
||||
if (TabButton != null)
|
||||
{
|
||||
TabButton.Content = tab.gameObject;
|
||||
@@ -216,7 +218,11 @@ public abstract class LocalSettingsTab(ConfigFile config)
|
||||
contentIndex++;
|
||||
}
|
||||
|
||||
Scroller.SetBounds(new FloatRange(0, (Settings.Count + Buttons.Count) * 0.5f - 5f), new FloatRange(0, 0));
|
||||
var estimatedScrollRange = (Settings.Count + Buttons.Count) * 0.5f - 5f;
|
||||
var layoutScrollRange = contentOffset - 5f;
|
||||
var scrollRange = Mathf.Max(0f, estimatedScrollRange, layoutScrollRange);
|
||||
Scroller.SetBounds(new FloatRange(0, scrollRange), new FloatRange(0, 0));
|
||||
Scroller.ScrollToTop();
|
||||
return tab;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user