Add closest seam option

Make mouse back button work
This commit is contained in:
Lars Brubaker 2021-08-12 17:47:01 -07:00
parent b55438171a
commit ab96018191
4 changed files with 25 additions and 10 deletions

View file

@ -601,7 +601,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
PresentationName = "Seam Placement".Localize(),
HelpText = "What to do when there is not a good place to hide the seam.".Localize(),
DataEditType = DataEditTypes.LIST,
ListValues = "Furthest Back,Centered In Back,Randomized",
ListValues = "Furthest Back,Centered In Back,Randomized,Closest",
DefaultValue = "Furthest Back",
},
new SliceSettingData()

View file

@ -28,7 +28,6 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MatterHackers.Agg;
@ -60,7 +59,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
{
this.CloseChildren();
var upbutton = new IconButton(StaticData.Instance.LoadIcon(Path.Combine("Library", "back.png"), 20, 20).SetToColor(theme.TextColor), theme)
var backButton = new IconButton(StaticData.Instance.LoadIcon(Path.Combine("Library", "back.png"), 20, 20).SetToColor(theme.TextColor), theme)
{
VAnchor = VAnchor.Fit | VAnchor.Center,
Enabled = currentContainer.Parent != null,
@ -69,14 +68,11 @@ namespace MatterHackers.MatterControl.CustomWidgets
Margin = theme.ButtonSpacing,
MinimumSize = new Vector2(theme.ButtonHeight, theme.ButtonHeight)
};
upbutton.Click += (s, e) =>
backButton.Click += (s, e) =>
{
if (libraryContext.ActiveContainer.Parent != null)
{
UiThread.RunOnIdle(() => libraryContext.ActiveContainer = libraryContext.ActiveContainer.Parent);
}
NavigateBack();
};
this.AddChild(upbutton);
this.AddChild(backButton);
bool firstItem = true;
@ -158,5 +154,13 @@ namespace MatterHackers.MatterControl.CustomWidgets
this.SetContainer(libraryContext.ActiveContainer);
base.OnLoad(args);
}
public void NavigateBack()
{
if (libraryContext.ActiveContainer.Parent != null)
{
UiThread.RunOnIdle(() => libraryContext.ActiveContainer = libraryContext.ActiveContainer.Parent);
}
}
}
}

View file

@ -1052,6 +1052,17 @@ namespace MatterHackers.MatterControl.PrintLibrary
base.OnClosed(e);
}
public override void OnMouseDown(MouseEventArgs mouseEvent)
{
if (mouseEvent.Button == MouseButtons.XButton1)
{
// user pressed the back button
breadCrumbWidget.NavigateBack();
}
base.OnMouseDown(mouseEvent);
}
public override void OnMouseMove(MouseEventArgs mouseEvent)
{
if (PositionWithinLocalBounds(mouseEvent.X, mouseEvent.Y)

@ -1 +1 @@
Subproject commit c3b70a99460b16c728c86a7eb1ba29faccb9d7ce
Subproject commit cfdb25b9b6564ff8039777531656a162fd2cae99