Object3DControls are dynamically added for a given part
This commit is contained in:
parent
77ec3d5909
commit
a35347df4a
17 changed files with 143 additions and 197 deletions
|
|
@ -147,6 +147,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Object3DControlContext.GuiSurface.AfterDraw += Object3DControl_AfterDraw;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
zHeightDisplayInfo.Close();
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawMoveControls = true;
|
||||
|
|
@ -280,7 +285,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
base.CancelOperation();
|
||||
}
|
||||
|
||||
public override void SetPosition(IObject3D selectedItem)
|
||||
public override void SetPosition(IObject3D selectedItem, MeshSelectInfo selectInfo)
|
||||
{
|
||||
AxisAlignedBoundingBox selectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
shadowColor = theme.ResolveColor(theme.BackgroundColor, Color.Black.WithAlpha(80)).WithAlpha(110);
|
||||
}
|
||||
|
||||
public override void SetPosition(IObject3D selectedItem)
|
||||
public override void SetPosition(IObject3D selectedItem, MeshSelectInfo selectInfo)
|
||||
{
|
||||
AxisAlignedBoundingBox selectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
Vector3 boundsCenter = selectedBounds.Center;
|
||||
|
|
@ -84,5 +84,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
// no widgets allocated so nothing to close
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,18 +41,24 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private double lineLength = 15;
|
||||
private Vector2[] lines = new Vector2[4];
|
||||
|
||||
private MeshSelectInfo meshSelectInfo;
|
||||
|
||||
public SnappingIndicators(IObject3DControlContext context, MeshSelectInfo currentSelectInfo)
|
||||
public SnappingIndicators(IObject3DControlContext context)
|
||||
: base(context)
|
||||
{
|
||||
this.DrawOnTop = true;
|
||||
this.meshSelectInfo = currentSelectInfo;
|
||||
Object3DControlContext.GuiSurface.AfterDraw += Object3DControl_AfterDraw;
|
||||
}
|
||||
|
||||
public override void SetPosition(IObject3D selectedItem)
|
||||
private MeshSelectInfo meshSelectInfo;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
// no objects need to be removed
|
||||
}
|
||||
|
||||
public override void SetPosition(IObject3D selectedItem, MeshSelectInfo meshSelectInfo)
|
||||
{
|
||||
this.meshSelectInfo = meshSelectInfo;
|
||||
|
||||
// draw the hight from the bottom to the bed
|
||||
AxisAlignedBoundingBox selectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
|
||||
|
|
@ -71,6 +77,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
lines[2] = world.GetScreenPosition(cornerPoint - new Vector3(0, distToStart * distBetweenPixelsWorldSpace, 0));
|
||||
lines[3] = world.GetScreenPosition(cornerPoint - new Vector3(0, (distToStart + lineLength) * distBetweenPixelsWorldSpace, 0));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case HitQuadrant.LT:
|
||||
|
|
@ -84,6 +91,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
lines[2] = world.GetScreenPosition(cornerPoint + new Vector3(0, distToStart * distBetweenPixelsWorldSpace, 0));
|
||||
lines[3] = world.GetScreenPosition(cornerPoint + new Vector3(0, (distToStart + lineLength) * distBetweenPixelsWorldSpace, 0));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case HitQuadrant.RB:
|
||||
|
|
@ -97,6 +105,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
lines[2] = world.GetScreenPosition(cornerPoint - new Vector3(0, distToStart * distBetweenPixelsWorldSpace, 0));
|
||||
lines[3] = world.GetScreenPosition(cornerPoint - new Vector3(0, (distToStart + lineLength) * distBetweenPixelsWorldSpace, 0));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case HitQuadrant.RT:
|
||||
|
|
@ -110,6 +119,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
lines[2] = world.GetScreenPosition(cornerPoint + new Vector3(0, distToStart * distBetweenPixelsWorldSpace, 0));
|
||||
lines[3] = world.GetScreenPosition(cornerPoint + new Vector3(0, (distToStart + lineLength) * distBetweenPixelsWorldSpace, 0));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -118,7 +128,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (Object3DControlContext.Scene.SelectedItem != null
|
||||
&& Object3DControlContext.SnapGridDistance > 0
|
||||
&& meshSelectInfo.DownOnPart)
|
||||
&& meshSelectInfo?.DownOnPart == true)
|
||||
{
|
||||
if (drawEvent != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue