Exemple #1
0
        public void EndCurrentDrag()
        {
            if (!isDragging)
            {
                return;
            }

            //Debug.Log("ending drag");


            if (draggingDP == null)
            {
                Debug.LogError("Dragging DP null");
                return;
            }

            draggingDP.onOverlayDragged?.Invoke(false);

            //If it was using a snap point in the past, clear it:
            draggingDP.ClearAllSnapData();

            //If we ended the drag on a new snap point
            if (isUsingSnapPoint)
            {
                draggingDP.TransitionOverlayPosition(activeSnapPoint.transform.localPosition, activeSnapPoint.transform.localEulerAngles, transitionSnapPointSpeed,
                                                     Ease.InOutCubic, false);

                //Remove any previous thing
                if (activeSnapPoint.dpApp != null)
                {
                    TheBarManager.I.MinimizeApp(activeSnapPoint.dpApp.appKey);
                }
                else if (activeSnapPoint.dpBase != null)
                {
                    DPUIManager.Animate(activeSnapPoint.dpBase, DPAnimation.FadeOut);
                    activeSnapPoint.ClearAllSnapData();
                }

                if (draggingDP.hasDPAppParent && draggingDP.dpAppParent.dpMain == draggingDP)
                {
                    activeSnapPoint.SetSnappedApp(draggingDP.dpAppParent);
                }
                else
                {
                    activeSnapPoint.SetSnappedDP(draggingDP);
                }
            }


            TheBarManager.I.ToggleSnapPointsVisible(false);

            isDragging = false;

            dummyDragChild.parent = null;

            draggingDP      = null;
            activeSnapPoint = null;

            draggingDPIsAutoCurving = false;
        }
        public void CloseDP(DPOverlayBase dpBase)
        {
            dpBase.ClearAllSnapData();

            if (DPToolbar.I.activeDP == dpBase)
            {
                DPToolbar.I.ResetToolbar();
            }

            Destroy(dpBase.gameObject);
        }