From 40de31d8d7d0a58f8ff7900bd9405982b7ac555c Mon Sep 17 00:00:00 2001 From: LarsBrubaker Date: Thu, 15 Apr 2021 07:42:28 -0700 Subject: [PATCH] Working to hold controls steady --- .../EditorTools/ScaleControls/ScaleHeightControl.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleHeightControl.cs b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleHeightControl.cs index 8f238f96e..bae90d2a8 100644 --- a/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleHeightControl.cs +++ b/MatterControlLib/DesignTools/EditorTools/ScaleControls/ScaleHeightControl.cs @@ -358,9 +358,12 @@ namespace MatterHackers.Plugins.EditorTools Vector3 arrowCenter = topPosition; arrowCenter.Z += arrowSize / 2 * distBetweenPixelsWorldSpace; - var centerMatrix = Matrix4X4.CreateTranslation(arrowCenter); - centerMatrix = Matrix4X4.CreateScale(distBetweenPixelsWorldSpace) * centerMatrix; - TotalTransform = centerMatrix; + var normal = Vector3.UnitZ.Transform(selectedItem.Matrix); + var up = Vector3.UnitX.Transform(selectedItem.Matrix); + var rotation = Matrix4X4.LookAt(Vector3.Zero, normal, up); + rotation = Matrix4X4.Identity; + + TotalTransform = rotation * Matrix4X4.CreateScale(distBetweenPixelsWorldSpace) * Matrix4X4.CreateTranslation(arrowCenter); } private void Object3DControl_BeforeDraw(object sender, DrawEventArgs drawEvent)