Finished a scale matrix edge control
This commit is contained in:
parent
a293c80c5d
commit
90452dfc53
7 changed files with 24 additions and 27 deletions
|
|
@ -289,6 +289,9 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
selectedItem.Invalidate(new InvalidateArgs(selectedItem, InvalidateType.DisplayValues));
|
||||
}
|
||||
|
||||
var startMatrix = selectedItem.Matrix;
|
||||
selectedItem.Matrix = startMatrix;
|
||||
|
||||
await selectedItem.Rebuild();
|
||||
|
||||
var postScaleBottom = GetBottomPosition(selectedItem);
|
||||
|
|
@ -354,8 +357,6 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
public override void SetPosition(IObject3D selectedItem, MeshSelectInfo selectInfo)
|
||||
{
|
||||
AxisAlignedBoundingBox selectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
|
||||
var topPosition = GetTopPosition(selectedItem);
|
||||
double distBetweenPixelsWorldSpace = Object3DControlContext.World.GetWorldUnitsPerScreenPixelAtPosition(topPosition);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.Plugins.EditorTools
|
||||
{
|
||||
public class ScaleCornerControl : Object3DControl
|
||||
public class ScaleMatrixCornerControl : Object3DControl
|
||||
{
|
||||
public IObject3D ActiveSelectedItem { get; set; }
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
private readonly InlineEditControl yValueDisplayInfo;
|
||||
private bool hadClickOnControl;
|
||||
|
||||
public ScaleCornerControl(IObject3DControlContext context, int cornerIndex)
|
||||
public ScaleMatrixCornerControl(IObject3DControlContext context, int cornerIndex)
|
||||
: base(context)
|
||||
{
|
||||
theme = MatterControl.AppContext.Theme;
|
||||
|
|
@ -160,7 +160,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
&& Object3DControlContext.SelectedObject3DControl as ScaleCornerControl == null)
|
||||
&& Object3DControlContext.SelectedObject3DControl as ScaleMatrixCornerControl == null)
|
||||
{
|
||||
shouldDrawScaleControls = false;
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.Plugins.EditorTools
|
||||
{
|
||||
public class ScaleEdgeControl : Object3DControl
|
||||
public class ScaleMatrixEdgeControl : Object3DControl
|
||||
{
|
||||
public IObject3D ActiveSelectedItem { get; set; }
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
private readonly InlineEditControl yValueDisplayInfo;
|
||||
private bool hadClickOnControl;
|
||||
|
||||
public ScaleEdgeControl(IObject3DControlContext context, int edgeIndex)
|
||||
public ScaleMatrixEdgeControl(IObject3DControlContext context, int edgeIndex)
|
||||
: base(context)
|
||||
{
|
||||
theme = MatterControl.AppContext.Theme;
|
||||
|
|
@ -170,7 +170,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
&& Object3DControlContext.SelectedObject3DControl as ScaleEdgeControl == null)
|
||||
&& Object3DControlContext.SelectedObject3DControl as ScaleMatrixEdgeControl == null)
|
||||
{
|
||||
shouldDrawScaleControls = false;
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
Vector3 newSize = Vector3.Zero;
|
||||
newSize.Z = zValueDisplayInfo.Value;
|
||||
Vector3 scaleAmount = ScaleCornerControl.GetScalingConsideringShiftKey(originalSelectedBounds, mouseDownSelectedBounds, newSize, Object3DControlContext.GuiSurface.ModifierKeys);
|
||||
Vector3 scaleAmount = ScaleMatrixCornerControl.GetScalingConsideringShiftKey(originalSelectedBounds, mouseDownSelectedBounds, newSize, Object3DControlContext.GuiSurface.ModifierKeys);
|
||||
|
||||
var scale = Matrix4X4.CreateScale(scaleAmount);
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
newSize.Z = newPosition.Z - lockedBottom.Z;
|
||||
|
||||
// scale it
|
||||
Vector3 scaleAmount = ScaleCornerControl.GetScalingConsideringShiftKey(originalSelectedBounds, mouseDownSelectedBounds, newSize, Object3DControlContext.GuiSurface.ModifierKeys);
|
||||
Vector3 scaleAmount = ScaleMatrixCornerControl.GetScalingConsideringShiftKey(originalSelectedBounds, mouseDownSelectedBounds, newSize, Object3DControlContext.GuiSurface.ModifierKeys);
|
||||
|
||||
var scale = Matrix4X4.CreateScale(scaleAmount);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,11 +80,11 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
var path = new VertexStorage();
|
||||
path.MoveTo(0, 0);
|
||||
path.LineTo(Math.Sqrt(2), 0);
|
||||
path.LineTo(0, Height);
|
||||
path.LineTo(Math.Sqrt(2) * 100, 0);
|
||||
path.LineTo(0, Height * 100);
|
||||
|
||||
var mesh = VertexSourceToMesh.Revolve(path, 4);
|
||||
mesh.Transform(Matrix4X4.CreateRotationZ(MathHelper.DegreesToRadians(45)) * Matrix4X4.CreateScale(Width / 2, Depth / 2, 1));
|
||||
mesh.Transform(Matrix4X4.CreateRotationZ(MathHelper.DegreesToRadians(45)) * Matrix4X4.CreateScale(Width / 2 / 100.0, Depth / 2 / 100.0, 1 / 100.0));
|
||||
Mesh = mesh;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,11 +181,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (selectedItem is IObjectWithHeight heightObject)
|
||||
{
|
||||
// When this is ready make the debug behavior the only behavior
|
||||
#if DEBUG
|
||||
Object3DControls.Add(new ScaleHeightControl(this));
|
||||
#else
|
||||
Object3DControls.Add(new ScaleMatrixTopControl(this));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -196,7 +192,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
#if DEBUG
|
||||
//Object3DControls.Add(new ScaleCornerControl(this, 0));
|
||||
Object3DControls.Add(new ScaleEdgeControl(this, 0));
|
||||
Object3DControls.Add(new ScaleMatrixEdgeControl(this, 0));
|
||||
#else
|
||||
AddControls(ControlTypes.ScaleMatrixXY);
|
||||
#endif
|
||||
|
|
@ -240,15 +236,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (controls.HasFlag(ControlTypes.ScaleMatrixXY))
|
||||
{
|
||||
Object3DControls.Add(new ScaleCornerControl(this, 0));
|
||||
Object3DControls.Add(new ScaleCornerControl(this, 1));
|
||||
Object3DControls.Add(new ScaleCornerControl(this, 2));
|
||||
Object3DControls.Add(new ScaleCornerControl(this, 3));
|
||||
Object3DControls.Add(new ScaleMatrixCornerControl(this, 0));
|
||||
Object3DControls.Add(new ScaleMatrixCornerControl(this, 1));
|
||||
Object3DControls.Add(new ScaleMatrixCornerControl(this, 2));
|
||||
Object3DControls.Add(new ScaleMatrixCornerControl(this, 3));
|
||||
|
||||
Object3DControls.Add(new ScaleEdgeControl(this, 0));
|
||||
Object3DControls.Add(new ScaleEdgeControl(this, 1));
|
||||
Object3DControls.Add(new ScaleEdgeControl(this, 2));
|
||||
Object3DControls.Add(new ScaleEdgeControl(this, 3));
|
||||
Object3DControls.Add(new ScaleMatrixEdgeControl(this, 0));
|
||||
Object3DControls.Add(new ScaleMatrixEdgeControl(this, 1));
|
||||
Object3DControls.Add(new ScaleMatrixEdgeControl(this, 2));
|
||||
Object3DControls.Add(new ScaleMatrixEdgeControl(this, 3));
|
||||
}
|
||||
|
||||
if (controls.HasFlag(ControlTypes.Shadow))
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 21228a0b38ffbcdc9178cdf664820acd25ee7a3d
|
||||
Subproject commit 162a2cbe5376307e7b7c4ef6278a5c3b39820349
|
||||
Loading…
Add table
Add a link
Reference in a new issue