Esempio n. 1
0
        public void ItemDroppedOnto(DragItem dropped)
        {
            dropped.transform.SetSiblingIndex(divider.transform.GetSiblingIndex());
            divider.SetActive(false);

            orderingChanged?.Invoke();
        }
Esempio n. 2
0
        public void ElementDragged(DragItem element, PointerEventData eventData)
        {
            var dragPosition = transform.InverseTransformPoint(eventData.position);

            int newDividerIndex = GetNewDividerIndex(dragPosition, eventData.position);

            if (newDividerIndex < 0)
            {
                if (divider.activeSelf)
                {
                    divider.SetActive(false);
                }
                return;
            }

            if (!divider.activeSelf)
            {
                divider.SetActive(true);
            }
            if (newDividerIndex != divider.transform.GetSiblingIndex())
            {
                divider.transform.SetSiblingIndex(newDividerIndex);
            }
        }