Extract layer slider components to custom control

- Much easier to center layer counts to vertical slider
- Fix incorrect layer positions
- Abstract details from main control, expose only minimal complexity
- Issue MatterHackers/MCCentral#2114
Only 3 of 4 layers shown, no change between layers 1 and 2
This commit is contained in:
John Lewin 2017-10-21 20:22:14 -07:00
parent 0a978814f2
commit 06a0684a93
4 changed files with 222 additions and 109 deletions

View file

@ -170,7 +170,8 @@ namespace MatterHackers.MatterControl
// When the active layer changes we update the selected range accordingly - constrain to applicable values
if (this.RenderInfo != null)
{
this.RenderInfo.EndLayerIndex = Math.Min(this.LoadedGCode == null ? 0 : this.LoadedGCode.LayerCount - 1, Math.Max(activeLayerIndex, 1));
// TODO: Unexpected that rendering layer 2 requires that we set the range to 0-3. Seems like model should be updated to allow 0-2 to mean render up to layer 2
this.RenderInfo.EndLayerIndex = Math.Min(this.LoadedGCode == null ? 0 : this.LoadedGCode.LayerCount, Math.Max(activeLayerIndex + 1, 1));
}
ActiveLayerChanged?.Invoke(this, null);