private Vector3 MoveHandle(HashSet <int> vertices, Vector3 position, Vector3 axis, ref bool moved, float s)
        {
            float handleSize = HandleUtility.GetHandleSize(position) * size;

            CustomHandles.HandleResult result = CustomHandles.HandleResult.None;

            Vector3 dragPos = CustomHandles.DragHandle(position, axis,
                                                       handleSize, Handles.ConeHandleCap, out result, ctrl, s);

            if (result == CustomHandles.HandleResult.Drag)
            {
                brush.undone = true;
                Undo.RecordObject(brush, "Brush Edit");
                Vector3 offset = dragPos - position;

                foreach (var vert in vertices)
                {
                    brush.mesh.vertices[vert].position += offset;
                }

                brush.undone = false;

                brush.dirty = true;
                brush.Update();
            }

            moved |= result != CustomHandles.HandleResult.None;

            return(dragPos);
        }
        private Vector3 ScaleHandle(HashSet <int> vertices, Vector3 position, Vector3 axis, ref bool moved, ref float scaleMvt, float s)
        {
            float handleSize = HandleUtility.GetHandleSize(position) * size;

            CustomHandles.HandleResult result = CustomHandles.HandleResult.None;

            Vector3 dragPos = CustomHandles.DragHandle(position, axis,
                                                       handleSize, Handles.SphereHandleCap, out result, ctrl, s);

            if (result == CustomHandles.HandleResult.Drag)
            {
                brush.undone = true;
                Undo.RecordObject(brush, "Brush Edit");
                Vector3 offset = dragPos - position;

                float amt = Vector3.Dot(offset, axis);
                scaleMvt += amt;
                Vector3 c = brush.mesh.GetVerticesCenter(vertices);

                foreach (var vert in vertices)
                {
                    Vector3 v = brush.mesh.vertices[vert].position;
                    v -= c;
                    Vector3 onAxis  = Vector3.Project(v, axis);
                    Vector3 offAxis = v - onAxis;
                    onAxis *= 1 + amt;

                    v = c + onAxis + offAxis;
                    brush.mesh.vertices[vert].position = v;
                }

                brush.undone = false;

                brush.dirty = true;
                brush.Update();
            }
            else if (result == CustomHandles.HandleResult.Release)
            {
                scaleMvt = 0;
            }

            moved |= result != CustomHandles.HandleResult.None;

            return(dragPos);
        }