Skip to content

Commit

Permalink
Merge pull request #205 from Carifio24/ref-frame-dirty-layers
Browse files Browse the repository at this point in the history
Mark layers as dirty when their reference frame's mean radius changes
  • Loading branch information
pkgw authored Feb 1, 2022
2 parents 071f394 + 90f3063 commit ad0ac45
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions WWTExplorer3d/FrameWizardMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public override bool Save()
{
bool failed = false;

double initialMeanRadius = frame.MeanRadius;
frame.MeanRadius = ParseAndValidateDouble(MeanRadius, frame.MeanRadius, ref failed);
frame.Oblateness = ParseAndValidateDouble(Oblateness, frame.Oblateness, ref failed);
frame.Scale = ParseAndValidateDouble(Scale, frame.Scale, ref failed);
Expand All @@ -52,6 +53,18 @@ public override bool Save()

frame.ShowAsPoint = ShowAsPoint.Checked;
frame.ShowOrbitPath = ShowOrbitPath.Checked;

// If the mean radius changes, mark each of the frame's layers as dirty so that it is re-drawn
bool radiusChanged = initialMeanRadius != frame.MeanRadius;
if (radiusChanged && LayerManager.AllMaps.ContainsKey(frame.name))
{
LayerMap map = LayerManager.AllMaps[frame.name];
foreach (Layer layer in map.Layers)
{
layer.CleanUp();
}
}

return !failed;
}

Expand Down

0 comments on commit ad0ac45

Please sign in to comment.