Skip to content

Commit

Permalink
apply calculated fields when loading settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed May 14, 2024
1 parent 8caf6e3 commit a65c18b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Binary file modified 1.5/Assemblies/CameraPlus.dll
Binary file not shown.
11 changes: 11 additions & 0 deletions Source/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ public override void ExposeData()
Tools.ScribeArrays(ref defaultInnerColors, "defaultInnerColors", defaults.defaultInnerColors);
Tools.ScribeArrays(ref customOuterColors, "customOuterColors", defaults.customOuterColors);
Tools.ScribeArrays(ref customInnerColors, "customInnerColors", defaults.customInnerColors);

ApplyCalculatedValues();
}

void ApplyCalculatedValues()
{
minRootResult = zoomedInPercent * 2;
maxRootResult = zoomedOutPercent * 2;
}

public void DoWindowContents(Rect inRect)
Expand All @@ -123,7 +131,10 @@ public void DoWindowContents(Rect inRect)
var restoreLen = restoreText.GetWidthCached() + 12f;
var rect = new Rect(inRect.width - restoreLen, inRect.yMin - 30f, restoreLen, 30f);
if (Widgets.ButtonText(rect, restoreText))
{
Traverse.IterateFields(new CameraPlusSettings(), Settings, (t1, t2) => t2.SetValue(t1.GetValue()));
ApplyCalculatedValues();
}

float previous;
var map = Current.Game?.CurrentMap;
Expand Down

0 comments on commit a65c18b

Please # to comment.