public override ActionResult DoAction()
        {
            if (MeshSelection.selectedObjectCount < 1)
            {
                return(ActionResult.NoSelection);
            }

            UndoUtility.RecordSelection("Offset Elements(s)");

            var handleRotation = MeshSelection.GetHandleRotation();

            foreach (var group in MeshSelection.elementSelection)
            {
                var mesh      = group.mesh;
                var positions = mesh.positionsInternal;
                var offset    = s_Translation.value;

                switch (s_CoordinateSpace.value)
                {
                case CoordinateSpace.World:
                case CoordinateSpace.Handle:
                {
                    var pre  = mesh.transform.localToWorldMatrix;
                    var post = mesh.transform.worldToLocalMatrix;

                    if (s_CoordinateSpace.value == CoordinateSpace.Handle)
                    {
                        offset = handleRotation * offset;
                    }

                    foreach (var index in mesh.selectedCoincidentVertices)
                    {
                        var p = pre.MultiplyPoint3x4(positions[index]);
                        p += offset;
                        positions[index] = post.MultiplyPoint3x4(p);
                    }
                    break;
                }

                case CoordinateSpace.Local:
                {
                    foreach (var index in mesh.selectedCoincidentVertices)
                    {
                        positions[index] += offset;
                    }
                    break;
                }

                case CoordinateSpace.Element:
                {
                    foreach (var elements in group.elementGroups)
                    {
                        var rotation = Quaternion.Inverse(mesh.transform.rotation) * elements.rotation;
                        var o        = rotation * offset;
                        foreach (var index in elements.indices)
                        {
                            positions[index] += o;
                        }
                    }
                    break;
                }
                }

                mesh.Rebuild();
                mesh.Optimize();
                ProBuilderEditor.Refresh();
            }

            if (ProBuilderEditor.selectMode.ContainsFlag(SelectMode.Edge | SelectMode.TextureEdge))
            {
                return(new ActionResult(ActionResult.Status.Success, "Move " + MeshSelection.selectedEdgeCount + (MeshSelection.selectedEdgeCount > 1 ? " Edges" : " Edge")));
            }
            if (ProBuilderEditor.selectMode.ContainsFlag(SelectMode.Face | SelectMode.TextureFace))
            {
                return(new ActionResult(ActionResult.Status.Success, "Move " + MeshSelection.selectedFaceCount + (MeshSelection.selectedFaceCount > 1 ? " Faces" : " Face")));
            }
            return(new ActionResult(ActionResult.Status.Success, "Move " + MeshSelection.selectedVertexCount + (MeshSelection.selectedVertexCount > 1 ? " Vertices" : " Vertex")));
        }
        void OnSceneGUI(SceneView view)
        {
            s_Points.Clear();

            var coord          = OffsetElements.s_CoordinateSpace.value;
            var offset         = OffsetElements.s_Translation.value;
            var handleRotation = MeshSelection.GetHandleRotation();
            var camera         = view.camera.transform.forward * -.01f;

            foreach (var selection in MeshSelection.elementSelection)
            {
                var mesh = selection.mesh;

                if (coord == OffsetElements.CoordinateSpace.Element)
                {
                    foreach (var elements in selection.elementGroups)
                    {
                        s_Points.Add(elements.position + camera);
                        s_Points.Add(elements.rotation * offset);
                    }
                }
                else
                {
                    var preview = offset;

                    if (coord == OffsetElements.CoordinateSpace.Handle)
                    {
                        preview = handleRotation * offset;
                    }
                    else if (coord == OffsetElements.CoordinateSpace.Local)
                    {
                        preview = mesh.transform.TransformDirection(offset);
                    }

                    foreach (var elements in selection.elementGroups)
                    {
                        s_Points.Add(elements.position + camera);
                        s_Points.Add(preview);
                    }
                }
            }

            using (var lines = new EditorHandleDrawing.LineDrawingScope(ColorUtility.GetColor(offset)))
            {
                for (int i = 0; i < s_Points.Count; i += 2)
                {
                    lines.DrawLine(s_Points[i], s_Points[i] + s_Points[i + 1]);
                }
            }

            using (var points = new EditorHandleDrawing.PointDrawingScope(Color.gray))
            {
                for (int i = 0; i < s_Points.Count; i += 2)
                {
                    points.Draw(s_Points[i]);
                }
            }

            using (var points = new EditorHandleDrawing.PointDrawingScope(ColorUtility.GetColor(offset)))
            {
                for (int i = 0; i < s_Points.Count; i += 2)
                {
                    points.Draw(s_Points[i] + s_Points[i + 1]);
                }
            }
        }