Draw the measurement bars when changing z.
This commit is contained in:
parent
099eadeb93
commit
8132713296
1 changed files with 48 additions and 1 deletions
|
|
@ -47,6 +47,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
View3DWidget view3DWidget;
|
||||
TextWidget numberDisplay;
|
||||
|
||||
static readonly int HorizontalLineLength = 30;
|
||||
|
||||
public HeightValueDisplay(View3DWidget view3DWidget)
|
||||
{
|
||||
BackgroundColor = RGBA_Bytes.White;
|
||||
|
|
@ -58,10 +60,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
AddChild(numberDisplay);
|
||||
VAnchor = VAnchor.FitToChildren;
|
||||
HAnchor = HAnchor.FitToChildren;
|
||||
|
||||
MeshViewerToDrawWith.TrackballTumbleWidget.DrawGlContent += TrackballTumbleWidget_DrawGlContent;
|
||||
MeshViewerToDrawWith.Draw += MeshViewerToDrawWith_Draw;
|
||||
}
|
||||
|
||||
MeshViewerWidget MeshViewerToDrawWith { get { return view3DWidget.meshViewerWidget; } }
|
||||
|
||||
int SelectedBoundSideIndex = 0;
|
||||
public void SetPosition()
|
||||
{
|
||||
if (MeshViewerToDrawWith.HaveSelection)
|
||||
|
|
@ -88,7 +94,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Vector2 testScreenPosition = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(bottomPoints[i]);
|
||||
if (testScreenPosition.x > screenPosition.x)
|
||||
{
|
||||
screenPosition = testScreenPosition;
|
||||
SelectedBoundSideIndex = i;
|
||||
startLineSelectionPos = testScreenPosition;
|
||||
Vector3 groundPos = bottomPoints[i];
|
||||
groundPos.z = 0;
|
||||
startLineGroundPos = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(groundPos);
|
||||
|
||||
screenPosition = testScreenPosition + new Vector2(HorizontalLineLength, 0);
|
||||
}
|
||||
}
|
||||
numberDisplay.Text = "{0:0.00mm}".FormatWith(selectedBounds.minXYZ.z);
|
||||
|
|
@ -99,6 +111,41 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
Vector2 startLineGroundPos;
|
||||
Vector2 startLineSelectionPos;
|
||||
|
||||
void MeshViewerToDrawWith_Draw(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible)
|
||||
{
|
||||
DrawEventArgs drawEvent = e as DrawEventArgs;
|
||||
if (drawEvent != null)
|
||||
{
|
||||
double yGround = (int)(startLineGroundPos.y + .5) + .5;
|
||||
drawEvent.graphics2D.Line(startLineGroundPos.x, yGround, startLineGroundPos.x + HorizontalLineLength - 5, yGround, RGBA_Bytes.Black);
|
||||
double ySelection = (int)(startLineSelectionPos.y + .5) + .5;
|
||||
drawEvent.graphics2D.Line(startLineSelectionPos.x, ySelection, startLineSelectionPos.x + HorizontalLineLength - 5, ySelection, RGBA_Bytes.Black);
|
||||
|
||||
Vector2 pointerBottom = new Vector2(startLineGroundPos.x + HorizontalLineLength / 2, yGround);
|
||||
Vector2 pointerTop = new Vector2(startLineSelectionPos.x + HorizontalLineLength / 2, ySelection);
|
||||
drawEvent.graphics2D.Line(pointerBottom, pointerTop, RGBA_Bytes.Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TrackballTumbleWidget_DrawGlContent(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible)
|
||||
{
|
||||
if (view3DWidget.DisplayAllValueData)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnMouseDown(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseDown(mouseEvent);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue