diff --git a/MatterControlLib/DesignTools/Constants.cs b/MatterControlLib/DesignTools/Constants.cs index 082cd1f0e..3ef466bdb 100644 --- a/MatterControlLib/DesignTools/Constants.cs +++ b/MatterControlLib/DesignTools/Constants.cs @@ -39,6 +39,8 @@ namespace MatterHackers.MatterControl.DesignTools /// /// Gets the alpha of the non z-buffered lines in the editor /// - public static int LineAlpha => 30; + public static int LineAlpha => 80; + + public static int Controls3DAlpha => 80; } } \ No newline at end of file diff --git a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleHeightControl.cs b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleHeightControl.cs index 238c4b8f5..1f4c7ab4e 100644 --- a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleHeightControl.cs +++ b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleHeightControl.cs @@ -180,7 +180,7 @@ namespace MatterHackers.Plugins.EditorTools if (shouldDrawScaleControls) { // don't draw if any other control is dragging - if (MouseIsOver) + if (MouseIsOver || MouseDownOnControl) { GLHelper.Render(topScaleMesh, theme.PrimaryAccentColor.WithAlpha(e.Alpha0to255), TotalTransform, RenderTypes.Shaded); } @@ -323,8 +323,6 @@ namespace MatterHackers.Plugins.EditorTools selectedItem.Invalidate(new InvalidateArgs(selectedItem, InvalidateType.DisplayValues)); } - var startMatrix = selectedItem.Matrix; - selectedItem.Matrix = startMatrix; await selectedItem.Rebuild(); diff --git a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixCornerControl.cs b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixCornerControl.cs index afd4bde03..20e567dda 100644 --- a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixCornerControl.cs +++ b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixCornerControl.cs @@ -176,7 +176,7 @@ namespace MatterHackers.Plugins.EditorTools if (shouldDrawScaleControls) { // don't draw if any other control is dragging - if (MouseIsOver) + if (MouseIsOver || MouseDownOnControl) { GLHelper.Render(minXminYMesh, theme.PrimaryAccentColor.WithAlpha(e.Alpha0to255), TotalTransform, RenderTypes.Shaded); } diff --git a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixEdgeControl.cs b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixEdgeControl.cs index 6faaeb00f..0e6978348 100644 --- a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixEdgeControl.cs +++ b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixEdgeControl.cs @@ -177,8 +177,7 @@ namespace MatterHackers.Plugins.EditorTools var selectedItem = RootSelection; - if (selectedItem != null - && Object3DControlContext.Scene.ShowSelectionShadow) + if (selectedItem != null) { // Ensures that functions in this scope run against the original instance reference rather than the // current value, thus avoiding null reference errors that would occur otherwise @@ -186,7 +185,7 @@ namespace MatterHackers.Plugins.EditorTools if (shouldDrawScaleControls) { // don't draw if any other control is dragging - if (MouseIsOver) + if (MouseIsOver || MouseDownOnControl) { GLHelper.Render(minXminYMesh, theme.PrimaryAccentColor.WithAlpha(e.Alpha0to255), TotalTransform, RenderTypes.Shaded); } @@ -459,7 +458,6 @@ namespace MatterHackers.Plugins.EditorTools lines.Add(Object3DControlContext.World.GetScreenPosition(xOtherSide - new Vector3(0, ySign * DistToStart * distBetweenPixelsWorldSpace, 0))); lines.Add(Object3DControlContext.World.GetScreenPosition(xOtherSide - new Vector3(0, ySign * (DistToStart + LineLength) * distBetweenPixelsWorldSpace, 0))); - } } } diff --git a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixTopControl.cs b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixTopControl.cs index 924c22bb4..ff9aec0c0 100644 --- a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixTopControl.cs +++ b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleMatrixTopControl.cs @@ -160,7 +160,7 @@ namespace MatterHackers.Plugins.EditorTools if (shouldDrawScaleControls) { // don't draw if any other control is dragging - if (MouseIsOver) + if (MouseIsOver || MouseDownOnControl) { GLHelper.Render(topScaleMesh, theme.PrimaryAccentColor.WithAlpha(e.Alpha0to255), TotalTransform, RenderTypes.Shaded); } diff --git a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleEdgeControl.cs b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleWidthDepthControl.cs similarity index 98% rename from MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleEdgeControl.cs rename to MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleWidthDepthControl.cs index 526db7c3a..111c7cfd3 100644 --- a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleEdgeControl.cs +++ b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleWidthDepthControl.cs @@ -45,7 +45,7 @@ using System.Collections.Generic; namespace MatterHackers.Plugins.EditorTools { - public class ScaleEdgeControl : Object3DControl + public class ScaleWidthDepthControl : Object3DControl { /// /// Edge starting from the back (+y) going ccw @@ -76,7 +76,7 @@ namespace MatterHackers.Plugins.EditorTools private Vector2 sizeOnMouseDown; - public ScaleEdgeControl(IObject3DControlContext context, int edgeIndex) + public ScaleWidthDepthControl(IObject3DControlContext context, int edgeIndex) : base(context) { theme = MatterControl.AppContext.Theme; @@ -232,8 +232,7 @@ namespace MatterHackers.Plugins.EditorTools var selectedItem = RootSelection; - if (selectedItem != null - && Object3DControlContext.Scene.ShowSelectionShadow) + if (selectedItem != null) { // Ensures that functions in this scope run against the original instance reference rather than the // current value, thus avoiding null reference errors that would occur otherwise @@ -241,7 +240,7 @@ namespace MatterHackers.Plugins.EditorTools if (shouldDrawScaleControls) { // don't draw if any other control is dragging - if (MouseIsOver) + if (MouseIsOver || MouseDownOnControl) { GLHelper.Render(minXminYMesh, theme.PrimaryAccentColor.WithAlpha(e.Alpha0to255), TotalTransform, RenderTypes.Shaded); } @@ -317,7 +316,7 @@ namespace MatterHackers.Plugins.EditorTools base.OnMouseDown(mouseEvent3D); } - public override void OnMouseMove(Mouse3DEventArgs mouseEvent3D, bool mouseIsOver) + public override async void OnMouseMove(Mouse3DEventArgs mouseEvent3D, bool mouseIsOver) { var selectedItem = RootSelection; ActiveSelectedItem = selectedItem; @@ -387,6 +386,8 @@ namespace MatterHackers.Plugins.EditorTools widthDepthItem.Depth *= scaleAmount.Y; } + await selectedItem.Rebuild(); + // and keep the locked edge in place Vector3 newLockedEdge = GetEdgePosition(selectedItem, (edgeIndex + 2) % 4); diff --git a/MatterControlLib/PartPreviewWindow/View3D/Gui3D/MoveInZControl.cs b/MatterControlLib/PartPreviewWindow/View3D/Gui3D/MoveInZControl.cs index 0e5036004..d61d2e198 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Gui3D/MoveInZControl.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Gui3D/MoveInZControl.cs @@ -168,7 +168,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (shouldDrawMoveControls) { // don't draw if any other control is dragging - if (MouseIsOver) + if (MouseIsOver || MouseDownOnControl) { GLHelper.Render(upArrowMesh, theme.PrimaryAccentColor, TotalTransform, RenderTypes.Shaded); } diff --git a/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs b/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs index 978040e1a..5dd6c460d 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs @@ -191,7 +191,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (selectedItem is IObjectWithWidthAndDepth widthAndDepth) { #if DEBUG - Object3DControls.Add(new ScaleEdgeControl(this, 0)); + Object3DControls.Add(new ScaleWidthDepthControl(this, 0)); #else AddControls(ControlTypes.ScaleMatrixXY); #endif @@ -1122,7 +1122,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { if (object3DControl.DrawOnTop) { - object3DControl.Draw(new DrawGlContentEventArgs(false, 60, e)); + object3DControl.Draw(new DrawGlContentEventArgs(false, Constants.Controls3DAlpha, e)); } }