fixing more pathing code

This commit is contained in:
Lars Brubaker 2022-08-11 18:37:06 -07:00
parent aadec8b9f5
commit f5c8b2008c
5 changed files with 25 additions and 10 deletions

View file

@ -173,8 +173,6 @@ namespace MatterHackers.MatterControl.DesignTools
[MaxDecimalPlaces(2)]
public double MinSurfaceArea {get; set; } = 1;
public override IVertexSource VertexSource { get; set; } = new VertexStorage();
public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer)
{
object3DControlsLayer.AddControls(ControlTypes.Standard2D);
@ -273,7 +271,7 @@ namespace MatterHackers.MatterControl.DesignTools
affine *= Affine.NewTranslation(-aabb.XSize / 2, -aabb.YSize / 2);
rawVectorShape.transform(affine);
this.VertexSource = rawVectorShape;
this.VertexStorage = rawVectorShape;
progressReporter?.Invoke(1, null);
}

View file

@ -198,14 +198,14 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
public static void DrawPath(this IObject3D item)
{
if (item.VertexSource != null)
if (item.GetVertexSource() != null)
{
bool first = true;
var lastPosition = Vector2.Zero;
var maxXYZ = item.GetAxisAlignedBoundingBox().MaxXYZ;
maxXYZ = maxXYZ.Transform(item.Matrix.Inverted);
var firstMove = Vector2.Zero;
foreach (var vertex in item.VertexSource.Vertices())
foreach (var vertex in item.GetVertexSource().Vertices())
{
var position = vertex.position;
if (first)

View file

@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
[Description("The amount to expand the path lines.")]
public DoubleOrExpression Inflate { get; set; } = 1;
public DoubleOrExpression Inflate { get; set; } = .2;
[EnumDisplay(Mode = EnumDisplayAttribute.PresentationMode.Buttons)]
public ExpandStyles Style { get; set; } = ExpandStyles.Sharp;

View file

@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
[Description("The with of the outline.")]
public DoubleOrExpression OutlineWidth { get; set; } = 3;
public DoubleOrExpression OutlineWidth { get; set; } = .5;
[Description("The offset of the outside of the outline as a ratio of the width.")]
public DoubleOrExpression Offset { get; set; } = .5;

View file

@ -40,6 +40,7 @@ using MatterHackers.DataConverters3D;
using MatterHackers.DataConverters3D.UndoCommands;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.DesignTools.Operations;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.PolygonMesh;
using MatterHackers.PolygonMesh.Processors;
using MatterHackers.VectorMath;
@ -59,9 +60,11 @@ namespace MatterHackers.MatterControl.DesignTools
}
[HideChildrenFromTreeView]
public class TextObject3D : Object3D, IPropertyGridModifier
public class TextObject3D : Object3D, IPropertyGridModifier, IEditorDraw
{
[JsonConverter(typeof(StringEnumConverter))]
private bool refreshToolBar;
[JsonConverter(typeof(StringEnumConverter))]
public enum TextAlign
{
Left,
@ -304,6 +307,10 @@ namespace MatterHackers.MatterControl.DesignTools
Invalidate(InvalidateType.DisplayValues);
this.CancelAllParentBuilding();
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
if (refreshToolBar)
{
this.RefreshToolBar();
}
});
});
}
@ -316,8 +323,18 @@ namespace MatterHackers.MatterControl.DesignTools
change.SetRowVisible(nameof(Height), () => Output == OutputDimensions.Output3D);
if (change.Changed == nameof(Output))
{
this.RefreshToolBar();
refreshToolBar = true;
}
}
public void DrawEditor(Object3DControlsLayer object3DControlLayer, DrawEventArgs e)
{
this.DrawPath();
}
public AxisAlignedBoundingBox GetEditorWorldspaceAABB(Object3DControlsLayer layer)
{
return this.GetWorldspaceAabbOfDrawPath();
}
}
}