Ejemplo n.º 1
0
    public void OnControlPointBeginDrag(BaseEventData eventData)
    {
        if (!(eventData is PointerEventData))
        {
            return;
        }
        PointerEventData pointerData = eventData as PointerEventData;

        GameObject     dragging = pointerData.pointerDrag;
        DragNoteAnchor anchor   = dragging
                                  .GetComponentInParent <DragNoteAnchor>();
        int controlPointIndex = anchor
                                .GetControlPointIndex(dragging);

        ControlPointBeginDrag?.Invoke(dragging, controlPointIndex);
    }
Ejemplo n.º 2
0
    public void OnControlPointClick(BaseEventData eventData)
    {
        if (!(eventData is PointerEventData))
        {
            return;
        }
        PointerEventData pointerData = eventData as PointerEventData;

        if (pointerData.button !=
            PointerEventData.InputButton.Right)
        {
            return;
        }

        GameObject     clicked = pointerData.pointerPress;
        DragNoteAnchor anchor  = clicked
                                 .GetComponentInParent <DragNoteAnchor>();
        int controlPointIndex = anchor
                                .GetControlPointIndex(clicked);

        ControlPointRightClicked?.Invoke(
            clicked, controlPointIndex);
    }