From eed44c14df98178cb18cce5e2b15d62f90b62572 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 17 Feb 2024 19:47:18 -0600 Subject: [PATCH] Simplify code --- Source/Editor/Gizmo/TransformGizmoBase.cs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/Source/Editor/Gizmo/TransformGizmoBase.cs b/Source/Editor/Gizmo/TransformGizmoBase.cs index 5a46b6fbf..2ce1c8e5e 100644 --- a/Source/Editor/Gizmo/TransformGizmoBase.cs +++ b/Source/Editor/Gizmo/TransformGizmoBase.cs @@ -257,11 +257,7 @@ namespace FlaxEditor.Gizmo { var tDeltaAbs = Vector3.Abs(_tDelta); var maxDelta = Mathf.Max(tDeltaAbs.Y, tDeltaAbs.Z); - float sign = 0; - if (tDeltaAbs.Y > tDeltaAbs.Z) - sign = Mathf.Sign(_tDelta.Y); - else if (tDeltaAbs.Z > tDeltaAbs.Y) - sign = Mathf.Sign(_tDelta.Z); + float sign = Mathf.Sign(tDeltaAbs.Y > tDeltaAbs.Z ? _tDelta.Y : _tDelta.Z); delta = new Vector3(0, maxDelta * sign, maxDelta * sign); } else @@ -282,11 +278,7 @@ namespace FlaxEditor.Gizmo { var tDeltaAbs = Vector3.Abs(_tDelta); var maxDelta = Mathf.Max(tDeltaAbs.X, tDeltaAbs.Y); - float sign = 0; - if (tDeltaAbs.X > tDeltaAbs.Y) - sign = Mathf.Sign(_tDelta.X); - else if (tDeltaAbs.Y > tDeltaAbs.X) - sign = Mathf.Sign(_tDelta.Y); + float sign = Mathf.Sign(tDeltaAbs.X > tDeltaAbs.Y ? _tDelta.X : _tDelta.Y); delta = new Vector3(maxDelta * sign, maxDelta * sign, 0); } else @@ -307,11 +299,7 @@ namespace FlaxEditor.Gizmo { var tDeltaAbs = Vector3.Abs(_tDelta); var maxDelta = Mathf.Max(tDeltaAbs.X, tDeltaAbs.Z); - float sign = 0; - if (tDeltaAbs.X > tDeltaAbs.Z) - sign = Mathf.Sign(_tDelta.X); - else if (tDeltaAbs.Z > tDeltaAbs.X) - sign = Mathf.Sign(_tDelta.Z); + float sign = Mathf.Sign(tDeltaAbs.X > tDeltaAbs.Z ? _tDelta.X : _tDelta.Z); delta = new Vector3(maxDelta * sign, 0, maxDelta * sign); } else