diff --git a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs index 5ce012ffd..4f0904694 100644 --- a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs @@ -27,31 +27,30 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; using ClipperLib; using MatterHackers.Agg; using MatterHackers.Agg.Image; +using MatterHackers.Agg.Image.ThresholdFunctions; using MatterHackers.Agg.Transform; +using MatterHackers.Agg.UI; using MatterHackers.Agg.VertexSource; using MatterHackers.DataConverters3D; using MatterHackers.Localizations; using MatterHackers.MarchingSquares; +using MatterHackers.MatterControl.PartPreviewWindow; +using MatterHackers.RenderOpenGl.OpenGl; +using MatterHackers.VectorMath; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using Polygon = System.Collections.Generic.List; +using Polygons = System.Collections.Generic.List>; namespace MatterHackers.MatterControl.DesignTools { - using MatterHackers.Agg.Image.ThresholdFunctions; - using MatterHackers.Agg.UI; - using MatterHackers.MatterControl.PartPreviewWindow; - using MatterHackers.RenderOpenGl.OpenGl; - using MatterHackers.VectorMath; - using System.ComponentModel.DataAnnotations; - using Polygon = List; - using Polygons = List>; - public class ImageToPathObject3D : Object3D, IPathObject, IEditorDraw { private ThresholdFunctions _featureDetector = ThresholdFunctions.Silhouette; @@ -64,12 +63,22 @@ namespace MatterHackers.MatterControl.DesignTools Name = "Image to Path".Localize(); } - public enum ThresholdFunctions { Silhouette, Intensity, Alpha, Hue } + public enum ThresholdFunctions + { + Silhouette, + Intensity, + Alpha, + Hue + } [EnumRename("Alpha", "Transparency")] public ThresholdFunctions FeatureDetector { - get { return _featureDetector; } + get + { + return _featureDetector; + } + set { if (value != _featureDetector) @@ -126,6 +135,7 @@ namespace MatterHackers.MatterControl.DesignTools { _histogramDisplayCache = new ImageBuffer(_histogramRawCache); } + UpdateHistogramDisplay(); return _histogramDisplayCache; @@ -155,6 +165,7 @@ namespace MatterHackers.MatterControl.DesignTools [Range(0, 1, ErrorMessage = "Value for {0} must be between {1} and {2}.")] public double RangeStart { get; set; } = .1; + [Range(0, 1, ErrorMessage = "Value for {0} must be between {1} and {2}.")] public double RangeEnd { get; set; } = 1; diff --git a/MatterControlLib/DesignTools/PublicPropertyEditor.cs b/MatterControlLib/DesignTools/PublicPropertyEditor.cs index 2163d968f..2d28039ea 100644 --- a/MatterControlLib/DesignTools/PublicPropertyEditor.cs +++ b/MatterControlLib/DesignTools/PublicPropertyEditor.cs @@ -509,7 +509,11 @@ namespace MatterHackers.MatterControl.DesignTools else if (propertyValue is ImageBuffer imageBuffer) { rowContainer = CreateSettingsColumn(property); - rowContainer.AddChild(new ImageWidget(imageBuffer)); + rowContainer.AddChild(new ImageWidget(imageBuffer) + { + HAnchor = HAnchor.Left, + Margin = new BorderDouble(0, 3) + }); } #if !__ANDROID__ else if (propertyValue is List stringList) @@ -532,7 +536,7 @@ namespace MatterHackers.MatterControl.DesignTools { if (readOnly) { - var valueField = new WrappedTextWidget(intValue.ToString(), + var valueField = new TextWidget(intValue.ToString(), textColor: theme.TextColor, pointSize: 10); @@ -582,11 +586,12 @@ namespace MatterHackers.MatterControl.DesignTools { if (readOnly) { - var valueField = new TextWidget(stringValue, textColor: theme.TextColor, pointSize: 10); - rowContainer = new SettingsRow(property.DisplayName.Localize(), - property.Description.Localize(), - valueField, - theme); + rowContainer = new WrappedTextWidget(stringValue, + textColor: theme.TextColor, + pointSize: 10) + { + Margin = 5 + }; } else // normal edit row { @@ -633,7 +638,7 @@ namespace MatterHackers.MatterControl.DesignTools { field = new EnumDisplayField(property, enumDisplayAttribute, theme) { - InitialValue = propertyValue.ToString() + InitialValue = propertyValue.ToString(), }; if (enumDisplayAttribute.Mode == EnumDisplayAttribute.PresentationMode.Tabs) diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/ImageEditor.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/ImageEditor.cs index c8ad40eed..d48a5c0f8 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/ImageEditor.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/ImageEditor.cs @@ -183,6 +183,7 @@ namespace MatterHackers.MatterControl.DesignTools { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, + Margin = new BorderDouble(8, 5) }; imageSection.ContentPanel.AddChild(row); @@ -191,6 +192,7 @@ namespace MatterHackers.MatterControl.DesignTools { Checked = imageObject.Invert, Margin = new BorderDouble(0), + VAnchor = VAnchor.Center, }; invertCheckbox.CheckedStateChanged += (s, e) => { diff --git a/MatterControlLib/SlicerConfiguration/UIFields/EnumDisplayField.cs b/MatterControlLib/SlicerConfiguration/UIFields/EnumDisplayField.cs index 118cfc340..f35dbed3d 100644 --- a/MatterControlLib/SlicerConfiguration/UIFields/EnumDisplayField.cs +++ b/MatterControlLib/SlicerConfiguration/UIFields/EnumDisplayField.cs @@ -82,7 +82,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration private void AddTabs(IEnumerable<(string Key, string Value)> enumItems) { - var menuRow = new FlowLayoutWidget(); + var menuRow = new FlowLayoutWidget() + { + Margin = 5 + }; int index = 0; foreach (var enumItem in enumItems)