Skip to content

Commit a65c18b

Browse files
committed
apply calculated fields when loading settings
1 parent 8caf6e3 commit a65c18b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

1.5/Assemblies/CameraPlus.dll

0 Bytes
Binary file not shown.

Source/Settings.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ public override void ExposeData()
112112
Tools.ScribeArrays(ref defaultInnerColors, "defaultInnerColors", defaults.defaultInnerColors);
113113
Tools.ScribeArrays(ref customOuterColors, "customOuterColors", defaults.customOuterColors);
114114
Tools.ScribeArrays(ref customInnerColors, "customInnerColors", defaults.customInnerColors);
115+
116+
ApplyCalculatedValues();
117+
}
118+
119+
void ApplyCalculatedValues()
120+
{
121+
minRootResult = zoomedInPercent * 2;
122+
maxRootResult = zoomedOutPercent * 2;
115123
}
116124

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

128139
float previous;
129140
var map = Current.Game?.CurrentMap;

0 commit comments

Comments
 (0)