Put in undo for Description and Measure tools.

issue: MatterHackers/MCCentral#6397
Need undo for description and measure tool moves
This commit is contained in:
Lars Brubaker 2021-04-29 11:17:31 -07:00
parent e8d07222c2
commit 3425b63f98
5 changed files with 82 additions and 19 deletions

View file

@ -57,6 +57,8 @@ namespace MatterHackers.MatterControl.DesignTools
private IObject3D owner;
private Action<Vector3> setPosition;
private Action<Vector3> editComplete;
private Mesh shape;
private bool mouseOver;
@ -68,7 +70,8 @@ namespace MatterHackers.MatterControl.DesignTools
public TracedPositionObject3DControl(IObject3DControlContext object3DControlContext,
IObject3D owner,
Func<Vector3> getPosition,
Action<Vector3> setPosition)
Action<Vector3> setPosition,
Action<Vector3> editComplete)
{
this.Object3DControlContext = object3DControlContext;
@ -76,6 +79,7 @@ namespace MatterHackers.MatterControl.DesignTools
this.context = object3DControlContext;
this.getPosition = getPosition;
this.setPosition = setPosition;
this.editComplete = editComplete;
this.shape = PlatonicSolids.CreateCube();
this.shape = SphereObject3D.CreateSphere(1, 15, 10);
collisionVolume = shape.CreateBVHData();
@ -216,7 +220,11 @@ namespace MatterHackers.MatterControl.DesignTools
public void OnMouseUp(Mouse3DEventArgs mouseEvent3D)
{
DownOnControl = false;
if (DownOnControl)
{
DownOnControl = false;
editComplete(mouseDownPosition);
}
}
public void SetPosition(IObject3D selectedItem, MeshSelectInfo selectInfo)