Working on improving the z edit control.

Adding number input
This commit is contained in:
larsbrubaker 2014-12-12 21:57:05 -08:00
parent a35e912c58
commit 4c8ae06b5b
4 changed files with 89 additions and 3 deletions

View file

@ -0,0 +1,73 @@
/*
Copyright (c) 2014, Lars Brubaker
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.MeshVisualizer;
using MatterHackers.PolygonMesh;
using MatterHackers.PolygonMesh.Processors;
using MatterHackers.RayTracer;
using MatterHackers.RenderOpenGl;
using MatterHackers.VectorMath;
using System;
using System.Collections.Generic;
using System.IO;
using MatterHackers.Agg.UI;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class HeightValueDisplay : GuiWidget
{
View3DWidget view3DWidget;
public HeightValueDisplay(View3DWidget view3DWidget)
: base(100, 20)
{
BackgroundColor = RGBA_Bytes.Cyan;
this.view3DWidget = view3DWidget;
view3DWidget.meshViewerWidget.AddChild(this);
}
public override void OnMouseDown(MouseEventArgs mouseEvent)
{
base.OnMouseDown(mouseEvent);
}
public override void OnMouseMove(MouseEventArgs mouseEvent)
{
base.OnMouseMove(mouseEvent);
}
public override void OnDraw(Graphics2D graphics2D)
{
base.OnDraw(graphics2D);
}
}
}

View file

@ -78,7 +78,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
zHitHeight = info.hitPosition.z;
base.OnMouseDown(mouseEvent3D);
}
@ -132,6 +132,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
arrowTransform = Matrix4X4.CreateScale(distBetweenPixelsWorldSpace) * arrowTransform;
TotalTransform = arrowTransform;
if (MouseOver || MouseDownOnControl)
{
view3DWidget.heightDisplay.Visible = true;
}
else if (!view3DWidget.DisplayAllValueData)
{
view3DWidget.heightDisplay.Visible = false;
}
}
private AxisAlignedBoundingBox GetBoundsForSelection()
@ -185,8 +195,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Vector3 bottomRight = new Vector3(selectedBounds.maxXYZ.x, selectedBounds.maxXYZ.y, selectedBounds.minXYZ.z);
Vector2 bottomRightScreenPosition = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(bottomRight);
}
else
{