Orthographic projection mode with dynamic near/far.
This commit is contained in:
parent
0834aff9f4
commit
e7947a2fd2
70 changed files with 2548 additions and 244 deletions
|
|
@ -163,6 +163,15 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
}
|
||||
}
|
||||
|
||||
AxisAlignedBoundingBox IObject3DControl.GetWorldspaceAABB()
|
||||
{
|
||||
// TODO: Untested.
|
||||
if (flattened != null)
|
||||
return new AxisAlignedBoundingBox(targets.Select(t => t.Point).ToArray());
|
||||
else
|
||||
return AxisAlignedBoundingBox.Empty();
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
// Clear and close selection targets
|
||||
|
|
|
|||
|
|
@ -201,6 +201,27 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
IObject3D selectedItem = RootSelection;
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (Object3DControlContext.SelectedObject3DControl == null)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, rotationHandle.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
}
|
||||
|
||||
if (mouseMoveInfo != null || mouseDownInfo != null || MouseIsOver)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, GetRotationCompassAABB(selectedItem));
|
||||
}
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
public Vector3 GetCornerPosition(IObject3D objectBeingRotated)
|
||||
{
|
||||
return GetCornerPosition(objectBeingRotated, out _);
|
||||
|
|
@ -326,7 +347,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
}
|
||||
|
||||
var hitPlane = new PlaneShape(RotationPlanNormal, RotationPlanNormal.Dot(controlCenter), null);
|
||||
IntersectInfo hitOnRotationPlane = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
IntersectInfo hitOnRotationPlane = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
if (hitOnRotationPlane != null)
|
||||
{
|
||||
AxisAlignedBoundingBox currentSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
|
|
@ -645,6 +666,42 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
}
|
||||
}
|
||||
|
||||
private AxisAlignedBoundingBox GetRotationCompassAABB(IObject3D selectedItem)
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
if (Object3DControlContext.Scene.SelectedItem == null)
|
||||
{
|
||||
return box;
|
||||
}
|
||||
|
||||
AxisAlignedBoundingBox currentSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
if (currentSelectedBounds.XSize > 100000)
|
||||
{
|
||||
return box;
|
||||
}
|
||||
|
||||
if (mouseMoveInfo != null)
|
||||
{
|
||||
Matrix4X4 rotationCenterTransform = GetRotationTransform(selectedItem, out double radius);
|
||||
|
||||
double innerRadius = radius + RingWidth / 2;
|
||||
double outerRadius = innerRadius + RingWidth;
|
||||
double snappingMarkRadius = outerRadius + 20;
|
||||
|
||||
if (mouseDownInfo != null || MouseIsOver)
|
||||
{
|
||||
double snapMarkerRadius = GuiWidget.DeviceScale * 10;
|
||||
double snapMarkerOuterRadius = snappingMarkRadius + snapMarkerRadius;
|
||||
box = AxisAlignedBoundingBox.Union(box, new AxisAlignedBoundingBox(-snapMarkerOuterRadius, -snapMarkerOuterRadius, 0, snapMarkerOuterRadius, snapMarkerOuterRadius, 0).NewTransformed(rotationCenterTransform));
|
||||
}
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool ForceHideAngle()
|
||||
{
|
||||
return (Object3DControlContext.HoveredObject3DControl != this
|
||||
|
|
|
|||
|
|
@ -171,15 +171,30 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
Object3DControlContext.GuiSurface.BeforeDraw -= Object3DControl_BeforeDraw;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
private bool ShouldDrawScaleControls()
|
||||
{
|
||||
bool shouldDrawScaleControls = controlVisible == null ? true : controlVisible();
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
&& Object3DControlContext.SelectedObject3DControl as ScaleDiameterControl == null)
|
||||
{
|
||||
shouldDrawScaleControls = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Matrix4X4 GetRingTransform()
|
||||
{
|
||||
Vector3 newBottomCenter = ObjectSpace.GetCenterPosition(RootSelection, placement);
|
||||
var rotation = Matrix4X4.CreateRotation(new Quaternion(RootSelection.Matrix));
|
||||
var translation = Matrix4X4.CreateTranslation(newBottomCenter);
|
||||
return rotation * translation;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
|
|
@ -201,10 +216,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
GLHelper.Render(grabControlMesh, color.WithAlpha(e.Alpha0to255), TotalTransform, RenderTypes.Shaded);
|
||||
}
|
||||
|
||||
Vector3 newBottomCenter = ObjectSpace.GetCenterPosition(selectedItem, placement);
|
||||
var rotation = Matrix4X4.CreateRotation(new Quaternion(selectedItem.Matrix));
|
||||
var translation = Matrix4X4.CreateTranslation(newBottomCenter);
|
||||
Object3DControlContext.World.RenderRing(rotation * translation, Vector3.Zero, getDiameters[diameterIndex](), 60, color.WithAlpha(e.Alpha0to255), 2, 0, e.ZBuffered);
|
||||
Object3DControlContext.World.RenderRing(GetRingTransform(), Vector3.Zero, getDiameters[diameterIndex](), 60, color.WithAlpha(e.Alpha0to255), 2, 0, e.ZBuffered);
|
||||
}
|
||||
|
||||
if (hitPlane != null)
|
||||
|
|
@ -223,6 +235,35 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, grabControlMesh.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
|
||||
var xform = GetRingTransform();
|
||||
var radius = getDiameters[diameterIndex]() / 2;
|
||||
box = AxisAlignedBoundingBox.Union(box, new AxisAlignedBoundingBox(-radius, -radius, 0, radius, radius, 0).NewTransformed(xform));
|
||||
}
|
||||
|
||||
if (shouldDrawScaleControls && (MouseIsOver || MouseDownOnControl))
|
||||
{
|
||||
var (a, b, c, d) = GetMeasureLine();
|
||||
box = AxisAlignedBoundingBox.Union(box, new AxisAlignedBoundingBox(new Vector3[] { a, b, c, d }));
|
||||
}
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
public override void OnMouseDown(Mouse3DEventArgs mouseEvent3D)
|
||||
{
|
||||
var selectedItem = RootSelection;
|
||||
|
|
@ -269,7 +310,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
if (MouseDownOnControl && hitPlane != null)
|
||||
{
|
||||
var info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
var info = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
|
||||
if (info != null
|
||||
&& selectedItem != null)
|
||||
|
|
|
|||
|
|
@ -194,10 +194,9 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
Object3DControlContext.GuiSurface.BeforeDraw -= Object3DControl_BeforeDraw;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
bool ShouldDrawScaleControls()
|
||||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
&& Object3DControlContext.SelectedObject3DControl as ScaleHeightControl == null)
|
||||
|
|
@ -205,6 +204,14 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
shouldDrawScaleControls = false;
|
||||
}
|
||||
|
||||
return shouldDrawScaleControls;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
|
|
@ -251,6 +258,27 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, topScaleMesh.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
}
|
||||
|
||||
box.ExpandToInclude(GetTopPosition(selectedItem));
|
||||
box.ExpandToInclude(GetBottomPosition(selectedItem));
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
public Vector3 GetBottomPosition(IObject3D selectedItem)
|
||||
{
|
||||
var meshBounds = selectedItem.GetAxisAlignedBoundingBox(selectedItem.Matrix.Inverted);
|
||||
|
|
@ -316,7 +344,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
if (MouseDownOnControl)
|
||||
{
|
||||
IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
IntersectInfo info = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
|
||||
if (info != null
|
||||
&& selectedItem != null)
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
transformAppliedByThis = selectedItem.Matrix;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
bool ShouldDrawScaleControls()
|
||||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
|
|
@ -162,6 +162,12 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
{
|
||||
shouldDrawScaleControls = false;
|
||||
}
|
||||
return shouldDrawScaleControls;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
|
|
@ -201,6 +207,40 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null && Object3DControlContext.Scene.ShowSelectionShadow)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, minXminYMesh.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
}
|
||||
|
||||
Vector3 startPosition = GetCornerPosition(selectedItem, quadrantIndex);
|
||||
Vector3 endPosition = GetCornerPosition(selectedItem, (quadrantIndex + 1) % 4);
|
||||
box.ExpandToInclude(startPosition);
|
||||
box.ExpandToInclude(endPosition);
|
||||
|
||||
if (MouseIsOver || MouseDownOnControl)
|
||||
{
|
||||
var (a0, a1, a2, a3) = GetMeasureLine(selectedItem, quadrantIndex);
|
||||
var (b0, b1, b2, b3) = GetMeasureLine(selectedItem, quadrantIndex + 1);
|
||||
box = AxisAlignedBoundingBox.Union(box, new AxisAlignedBoundingBox(new Vector3[] {
|
||||
a0, a1, a2, a3,
|
||||
b0, b1, b2, b3,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
private (Vector3 start0, Vector3 end0, Vector3 start1, Vector3 end1) GetMeasureLine(IObject3D selectedItem, int quadrant)
|
||||
{
|
||||
var corner = new Vector3[4];
|
||||
|
|
@ -308,7 +348,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
if (MouseDownOnControl && hitPlane != null)
|
||||
{
|
||||
IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
IntersectInfo info = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
|
||||
if (info != null
|
||||
&& selectedItem != null)
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
transformAppliedByThis = selectedItem.Matrix;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
bool ShouldDrawScaleControls()
|
||||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
|
|
@ -175,6 +175,12 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
{
|
||||
shouldDrawScaleControls = false;
|
||||
}
|
||||
return shouldDrawScaleControls;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
|
|
@ -200,6 +206,24 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, minXminYMesh.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
}
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
public Vector3 GetCornerPosition(IObject3D item, int quadrantIndex)
|
||||
{
|
||||
AxisAlignedBoundingBox originalSelectedBounds = item.GetAxisAlignedBoundingBox();
|
||||
|
|
@ -275,7 +299,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
if (MouseDownOnControl && hitPlane != null)
|
||||
{
|
||||
IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
IntersectInfo info = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
|
||||
if (info != null
|
||||
&& selectedItem != null)
|
||||
|
|
|
|||
|
|
@ -146,16 +146,22 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
Object3DControlContext.GuiSurface.BeforeDraw += Object3DControl_BeforeDraw;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
bool ShouldDrawScaleControls()
|
||||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
&& Object3DControlContext.SelectedObject3DControl as ScaleMatrixTopControl == null)
|
||||
{
|
||||
shouldDrawScaleControls = false;
|
||||
}
|
||||
return shouldDrawScaleControls;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
|
|
@ -205,6 +211,31 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, topScaleMesh.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
}
|
||||
|
||||
Vector3 topPosition = GetTopPosition(selectedItem);
|
||||
var bottomPosition = topPosition;
|
||||
var originalSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
bottomPosition.Z = originalSelectedBounds.MinXYZ.Z;
|
||||
box.ExpandToInclude(topPosition);
|
||||
box.ExpandToInclude(bottomPosition);
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
public Vector3 GetTopPosition(IObject3D selectedItem)
|
||||
{
|
||||
AxisAlignedBoundingBox originalSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
|
|
@ -250,7 +281,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
if (MouseDownOnControl)
|
||||
{
|
||||
IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
IntersectInfo info = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
|
||||
if (info != null
|
||||
&& selectedItem != null)
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
Object3DControlContext.GuiSurface.BeforeDraw -= Object3DControl_BeforeDraw;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
bool ShouldDrawScaleControls()
|
||||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
|
|
@ -178,6 +178,12 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
{
|
||||
shouldDrawScaleControls = false;
|
||||
}
|
||||
return shouldDrawScaleControls;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
|
|
@ -222,6 +228,39 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, minXminYMesh.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
}
|
||||
|
||||
Vector3 startPosition = ObjectSpace.GetCornerPosition(selectedItem, quadrantIndex);
|
||||
Vector3 endPosition = ObjectSpace.GetCornerPosition(selectedItem, (quadrantIndex + 1) % 4);
|
||||
box.ExpandToInclude(startPosition);
|
||||
box.ExpandToInclude(endPosition);
|
||||
|
||||
if (MouseIsOver || MouseDownOnControl)
|
||||
{
|
||||
var (a0, a1, a2, a3) = GetMeasureLine(quadrantIndex);
|
||||
var (b0, b1, b2, b3) = GetMeasureLine(quadrantIndex + 1);
|
||||
box = AxisAlignedBoundingBox.Union(box, new AxisAlignedBoundingBox(new Vector3[] {
|
||||
a0, a1, a2, a3,
|
||||
b0, b1, b2, b3
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
public override void OnMouseDown(Mouse3DEventArgs mouseEvent3D)
|
||||
{
|
||||
var selectedItem = RootSelection;
|
||||
|
|
@ -272,7 +311,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
if (MouseDownOnControl && hitPlane != null)
|
||||
{
|
||||
var info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
var info = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
|
||||
if (info != null
|
||||
&& selectedItem != null)
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
Object3DControlContext.GuiSurface.BeforeDraw -= Object3DControl_BeforeDraw;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
bool ShouldDrawScaleControls()
|
||||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
|
|
@ -203,6 +203,12 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
{
|
||||
shouldDrawScaleControls = false;
|
||||
}
|
||||
return shouldDrawScaleControls;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
|
|
@ -239,6 +245,32 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, minXminYMesh.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
}
|
||||
|
||||
if (MouseIsOver || MouseDownOnControl)
|
||||
{
|
||||
var (a0, a1, a2, a3) = GetMeasureLine(selectedItem);
|
||||
box = AxisAlignedBoundingBox.Union(box, new AxisAlignedBoundingBox(new Vector3[] {
|
||||
a0, a1, a2, a3
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
public override void OnMouseDown(Mouse3DEventArgs mouseEvent3D)
|
||||
{
|
||||
var selectedItem = RootSelection;
|
||||
|
|
@ -289,7 +321,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
if (MouseDownOnControl && hitPlane != null)
|
||||
{
|
||||
var info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
var info = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
|
||||
if (info != null
|
||||
&& selectedItem != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue