Constructed GCodeRenderInfo instance should use current ActiveLayerIndex

- Clip to current LayerCount if now smaller
- Issue MatterHackers/MCCentral#2497
Maintain GCode layer position across ReloadAll/Slice operations
This commit is contained in:
John Lewin 2017-12-24 10:36:49 -08:00
parent 36b7c2325d
commit 0173d42777
2 changed files with 11 additions and 1 deletions

View file

@ -421,7 +421,7 @@ namespace MatterHackers.MatterControl
this.GCodeRenderer = new GCodeRenderer(loadedGCode);
this.RenderInfo = new GCodeRenderInfo(
0,
1,
Math.Max(1, this.ActiveLayerIndex),
Agg.Transform.Affine.NewIdentity(),
1,
0,
@ -455,6 +455,14 @@ namespace MatterHackers.MatterControl
// Assign property causing event and UI load
this.LoadedGCode = loadedGCode;
// Constrain to max layers
if (this.ActiveLayerIndex > loadedGCode.LayerCount)
{
this.ActiveLayerIndex = loadedGCode.LayerCount;
}
ActiveLayerChanged?.Invoke(this, null);
}
public void InvalidateBedMesh()

View file

@ -99,6 +99,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Visible = sceneContext.RendererOptions.RenderSpeeds,
}));
}
this.Invalidate();
}
public override void OnClosed(ClosedEventArgs e)