private static void DrawNavigationArrow(Vector2 direction, IWindowNavigation fromObj, IWindowNavigation toObj)
        {
            if (fromObj == null || toObj == null)
            {
                return;
            }

            var fromTransform = fromObj.GetRectTransform();
            var toTransform   = toObj.GetRectTransform();

            Vector2 sideDir   = new Vector2(direction.y, -direction.x);
            Vector3 fromPoint = fromTransform.TransformPoint(WindowComponentNavigation.GetPointOnRectEdge(fromTransform, direction));
            Vector3 toPoint   = toTransform.TransformPoint(WindowComponentNavigation.GetPointOnRectEdge(toTransform, -direction));
            float   fromSize  = UnityEditor.HandleUtility.GetHandleSize(fromPoint) * 0.05f;
            float   toSize    = UnityEditor.HandleUtility.GetHandleSize(toPoint) * 0.05f;

            fromPoint += fromTransform.TransformDirection(sideDir) * fromSize;
            toPoint   += toTransform.TransformDirection(sideDir) * toSize;
            float   length      = Vector3.Distance(fromPoint, toPoint);
            Vector3 fromTangent = fromTransform.rotation * direction * length * 0.3f;
            Vector3 toTangent   = toTransform.rotation * -direction * length * 0.3f;

            UnityEditor.Handles.DrawBezier(fromPoint, toPoint, fromPoint + fromTangent, toPoint + toTangent, UnityEditor.Handles.color, null, kArrowThickness);
            UnityEditor.Handles.DrawAAPolyLine(kArrowThickness, toPoint, toPoint + toTransform.rotation * (-direction - sideDir) * toSize * kArrowHeadSize);
            UnityEditor.Handles.DrawAAPolyLine(kArrowThickness, toPoint, toPoint + toTransform.rotation * (-direction + sideDir) * toSize * kArrowHeadSize);
        }
 private void NavigateCopyTo(IWindowNavigation target)
 {
     if (target != null)
     {
         target.SetNavigationInfo(NavigationSide.Left, this.navigateLeftInfo);
         target.SetNavigationInfo(NavigationSide.Right, this.navigateRightInfo);
         target.SetNavigationInfo(NavigationSide.Up, this.navigateUpInfo);
         target.SetNavigationInfo(NavigationSide.Down, this.navigateDownInfo);
     }
 }
        private static void DrawNavigationForSelectable(IWindowNavigation sel)
        {
            if (sel == null)
            {
                return;
            }

            var  transform = sel.GetRectTransform();
            bool active    = UnityEditor.Selection.transforms.Any(e => e == transform);

            UnityEditor.Handles.color = new Color(1.0f, 0.9f, 0.1f, active ? 1.0f : 0.4f);

            WindowComponentNavigation.DrawNavigationArrow(-Vector2.right, sel, sel.NavigationFindLeft());
            WindowComponentNavigation.DrawNavigationArrow(Vector2.right, sel, sel.NavigationFindRight());
            WindowComponentNavigation.DrawNavigationArrow(Vector2.up, sel, sel.NavigationFindUp());
            WindowComponentNavigation.DrawNavigationArrow(-Vector2.up, sel, sel.NavigationFindDown());
        }
		private static void DrawNavigationArrow(Vector2 direction, IWindowNavigation fromObj, IWindowNavigation toObj) {
			
			if (fromObj == null || toObj == null) return;

			var fromTransform = fromObj.GetRectTransform();
			var toTransform = toObj.GetRectTransform();

			Vector2 sideDir = new Vector2(direction.y, -direction.x);
			Vector3 fromPoint = fromTransform.TransformPoint(WindowComponentNavigation.GetPointOnRectEdge(fromTransform, direction));
			Vector3 toPoint = toTransform.TransformPoint(WindowComponentNavigation.GetPointOnRectEdge(toTransform, -direction));
			float fromSize = UnityEditor.HandleUtility.GetHandleSize(fromPoint) * 0.05f;
			float toSize = UnityEditor.HandleUtility.GetHandleSize(toPoint) * 0.05f;
			fromPoint += fromTransform.TransformDirection(sideDir) * fromSize;
			toPoint += toTransform.TransformDirection(sideDir) * toSize;
			float length = Vector3.Distance(fromPoint, toPoint);
			Vector3 fromTangent = fromTransform.rotation * direction * length * 0.3f;
			Vector3 toTangent = toTransform.rotation * -direction * length * 0.3f;

			UnityEditor.Handles.DrawBezier(fromPoint, toPoint, fromPoint + fromTangent, toPoint + toTangent, UnityEditor.Handles.color, null, kArrowThickness);
			UnityEditor.Handles.DrawAAPolyLine(kArrowThickness, toPoint, toPoint + toTransform.rotation * (-direction - sideDir) * toSize * kArrowHeadSize);
			UnityEditor.Handles.DrawAAPolyLine(kArrowThickness, toPoint, toPoint + toTransform.rotation * (-direction + sideDir) * toSize * kArrowHeadSize);

		}
		private static void DrawNavigationForSelectable(IWindowNavigation sel) {
			
			if (sel == null) return;

			var transform = sel.GetRectTransform();
			bool active = UnityEditor.Selection.transforms.Any(e => e == transform);

			UnityEditor.Handles.color = new Color(1.0f, 0.9f, 0.1f, active ? 1.0f : 0.4f);

			WindowComponentNavigation.DrawNavigationArrow(-Vector2.right, sel, sel.NavigationFindLeft());
			WindowComponentNavigation.DrawNavigationArrow(Vector2.right, sel, sel.NavigationFindRight());
			WindowComponentNavigation.DrawNavigationArrow(Vector2.up, sel, sel.NavigationFindUp());
			WindowComponentNavigation.DrawNavigationArrow(-Vector2.up, sel, sel.NavigationFindDown());

		}
		private void NavigateCopyTo(IWindowNavigation target) {
			
			if (target != null) {

				target.SetNavigationInfo(NavigationSide.Left, this.navigateLeftInfo);
				target.SetNavigationInfo(NavigationSide.Right, this.navigateRightInfo);
				target.SetNavigationInfo(NavigationSide.Up, this.navigateUpInfo);
				target.SetNavigationInfo(NavigationSide.Down, this.navigateDownInfo);

			}

		}
 public void NavigationUnsetCustomContainer()
 {
     this.customContainer = null;
 }
 public void NavigationSetCustomContainer(IWindowNavigation container)
 {
     this.customContainer = container;
 }