static int CalculateZOrder(RoadEditorCollapsiblePanel groupPanel, UIDragEventParameter _)
        {
            var   dpts   = SortedDPTs(groupPanel);
            float mouseY = RoadEditorUtils.MouseGUIPosition().y;

            //Log.Debug(ThisMethod + "mouseY = " + mouseY);
            foreach (var dpt in dpts)
            {
                float dptY = dpt.component.absolutePosition.y + dpt.component.height;
                if (mouseY < dptY)
                {
                    return(Mathf.Max(dpt.component.zOrder - 1, 0));
                }
            }
            int lastZOrder = dpts[dpts.Length - 1].component.zOrder;

            return(lastZOrder + 1);
        }
        public static void OnDragStart(UICustomControl dpt, UIDragEventParameter eventParam)
        {
            if (RoadEditorUtils.IsDPTSelected(dpt))
            {
                LogCalled();
                eventParam.Use();
                eventParam.state = UIDragDropState.Dragging;

                var groupPanel = dpt.GetComponentInParent <RoadEditorCollapsiblePanel>();
                groupPanel.m_Panel.eventDragLeave -= OnLeave;
                groupPanel.m_Panel.eventDragEnter -= OnEnter;
                groupPanel.m_Panel.eventDragOver  -= OnOver;
                groupPanel.m_Panel.eventDragDrop  -= OnDrop;
                groupPanel.m_Panel.eventDragLeave += OnLeave;
                groupPanel.m_Panel.eventDragEnter += OnEnter;
                groupPanel.m_Panel.eventDragOver  += OnOver;
                groupPanel.m_Panel.eventDragDrop  += OnDrop;

                Log.Debug("creating `Add from template` button");
                Bar                  = groupPanel.Container.AddUIComponent <UIPanel>();
                Bar.width            = groupPanel.m_Panel.width;
                Bar.height           = 1;
                Bar.backgroundSprite = "TextFieldPanel";
                Bar.atlas            = KianCommons.UI.TextureUtil.Ingame;
                Bar.color            = Color.red;
                Bar.name             = "ARDragPointer";
                Bar.Show();
                Bar.zOrder = CalculateZOrder(groupPanel, eventParam);
                Bar.zOrder = CalculateZOrder(groupPanel, eventParam);

                // disable moving dpts
                foreach (var selectedDPT in RoadEditorUtils.SelectedDPTs)
                {
                    selectedDPT.component.isEnabled = false;
                    selectedDPT.component.opacity   = 0.5f;
                }
            }
        }