static void DrawPositionHandles(Shape shape, NativeArray <int> pointControlIds, int selectedPointId)
        {
            var shapeData = shape.ShapeData;

            for (int i = 0; i < shapeData.GetPolyPointCount(); i++)
            {
                // convert point
                //not working properly, disabled for now

                /*
                 * if (currentPointId == i &&
                 *      Event.current.type == EventType.MouseDown &&
                 *      Event.current.control)
                 * {
                 *      Undo.RecordObject(dataContainerObject, "Convert point type");
                 *      ConvertPoint(shape,i);
                 *
                 *      SetDataDirty();
                 *      Event.current.Use();
                 * }
                 * else {
                 */
                EditorGUI.BeginChangeCheck();
                Handles.color = i == selectedPointId ? selectedColor : baseColor;

                var   pos        = shapeData.GetPolyPosition(i);
                float handleSize = ShapeEditorUtils.GetHandleSize(pos) * 0.5f;

                var p = Handles.FreeMoveHandle(pos, Quaternion.identity, handleSize, Vector3.zero, (id, vector3, rotation, f, type) =>
                {
                    pointControlIds[i] = (id);
                    Handles.DotHandleCap(id, vector3, rotation, f, type);
                });

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(shape.dataContainerObject, "Move Shape Point");
                    if (shapeData.PolyDimension == ShapePolyDimension.TwoDimensional)
                    {
                        p.z = 0;
                    }

                    shapeData.SetPolyPosition(i, p);
                    ShapeEditorUtils.SetDataDirty(shape);
                }
                //}
            }
        }
        static void DrawTangentHandles(Shape shape, NativeArray <int> outTangentControlIds, NativeArray <int> inTangentControlIds, int selectedPointId)
        {
            var shapeData = shape.ShapeData;

            for (int i = 0; i < shapeData.GetPolyPointCount(); i++)
            {
                if (shapeData.GetPolyPointType(i) == ShapePointType.Corner)
                {
                    continue;
                }
                if (shapeData.GetPolyPointType(i) == ShapePointType.Smooth)
                {
                    continue;
                }

                EditorGUI.BeginChangeCheck();
                var pos = shapeData.GetPolyPosition(i);
                Handles.color = i == selectedPointId ? selectedColor : baseColor;

                var   origT1          = pos + shapeData.GetPolyInTangent(i);
                var   t1              = origT1;
                float handleSizeMulti = .8f;

                if (shapeData.IsStrokeClosed || i > 0)
                {
                    float handleSize = ShapeEditorUtils.GetHandleSize(t1);
                    t1 = Handles.FreeMoveHandle(t1, Quaternion.identity, handleSize * handleSizeMulti, Vector3.zero,
                                                (id, vector3, rotation, f, type) =>
                    {
                        inTangentControlIds[i] = id;
                        Handles.SphereHandleCap(id, vector3, rotation, f, type);
                    });
                }

                var origT2 = pos + shapeData.GetPolyOutTangent(i);
                var t2     = origT2;
                if (shapeData.IsStrokeClosed || i < shapeData.GetPolyPointCount() - 1)
                {
                    float handleSize = ShapeEditorUtils.GetHandleSize(t2);
                    t2 = Handles.FreeMoveHandle(t2, Quaternion.identity, handleSize * handleSizeMulti, Vector3.zero,
                                                (id, vector3, rotation, f, type) =>
                    {
                        outTangentControlIds[i] = id;
                        Handles.SphereHandleCap(id, vector3, rotation, f, type);
                    });
                }

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(shape.dataContainerObject, "Move Shape Tangent");

                    if (shapeData.PolyDimension == ShapePolyDimension.TwoDimensional)
                    {
                        t1.z = pos.z;
                        t2.z = pos.z;
                    }

                    shapeData.SetPolyInTangent(i, t1 - pos);
                    shapeData.SetPolyOutTangent(i, t2 - pos);

                    if (shapeData.GetPolyPointType(i) == ShapePointType.BezierContinous)
                    {
                        if ((origT1 - t1).sqrMagnitude > (origT2 - t2).sqrMagnitude)
                        {
                            shapeData.SetPolyOutTangent(i, -shapeData.GetPolyInTangent(i));
                        }
                        else
                        {
                            shapeData.SetPolyInTangent(i, -shapeData.GetPolyOutTangent(i));
                        }
                    }

                    ShapeEditorUtils.SetDataDirty(shape);
                }
            }
        }