Ejemplo n.º 1
0
 public void StopAnchorPreviewPanelTo(AnchorZoneBase anchorZone)
 {
     if (hoveredAnchorZone == anchorZone)
     {
         hoveredAnchorZone = null;
     }
 }
Ejemplo n.º 2
0
        public void OnEndPanelTabTranslate(PanelTab panelTab, PointerEventData draggingPointer)
        {
            if (draggedPanel == panelTab.Panel)
            {
                AnchorZoneBase targetAnchor = hoveredAnchorZone;
                if (hoveredAnchorZone != null)
                {
                    hoveredAnchorZone.OnPointerExit(draggingPointer);
                }

                AnchorZonesSetActive(false);

                if (targetAnchor == null || !targetAnchor.Execute(panelTab, draggingPointer))
                {
                    Panel detachedPanel = DetachPanelTab(draggedPanel, draggedPanel.GetTabIndex(panelTab.Content));
                    if (detachedPanel.Canvas != previewPanelCanvas)
                    {
                        previewPanelCanvas.UnanchoredPanelGroup.AddElement(detachedPanel);
                        detachedPanel.RectTransform.SetAsLastSibling();
                    }

                    detachedPanel.MoveTo(draggingPointer.position);
                }

                draggedPanel      = null;
                hoveredAnchorZone = null;
                previewPanel.gameObject.SetActive(false);
            }
        }
Ejemplo n.º 3
0
        public void CancelDraggingPanel()
        {
            if (draggedPanel != null)
            {
                if (draggedPanel.RectTransform.parent != draggedPanel.Canvas.RectTransform)
                {
                    draggedPanel.RectTransform.SetParent(draggedPanel.Canvas.RectTransform, false);
                    draggedPanel.RectTransform.SetAsLastSibling();
                }

                AnchorZonesSetActive(false);

                if (draggedPanel.Group is UnanchoredPanelGroup unanchoredGroup)
                {
                    unanchoredGroup.RestrictPanelToBounds(draggedPanel);
                }

                draggedPanel.Internal.Stop();
                draggedPanel = null;
            }

            hoveredAnchorZone = null;

            if (previewPanel.gameObject.activeSelf)
            {
                previewPanel.gameObject.SetActive(false);
            }
        }
Ejemplo n.º 4
0
        public bool AnchorPreviewPanelTo(AnchorZoneBase anchorZone)
        {
            if (hoveredAnchorZone != null || draggedPanel == null)
            {
                return(false);
            }

            hoveredAnchorZone = anchorZone;
            return(true);
        }