コード例 #1
0
 public ContextGenericMenuPopup(GitOverlay gitOverlay, GitAnimation gitAnimation)
 {
     this.gitOverlay   = gitOverlay;
     this.gitAnimation = gitAnimation;
     elements          = new List <Element>();
     transitionTween   = GitAnimation.Empty;
 }
コード例 #2
0
        public override void OnGUI(Rect rect)
        {
            if (elementStyle == null)
            {
                InitStyles();
            }
            if ((Event.current.type == EventType.MouseMove && rect.Contains(Event.current.mousePosition)) || transitionTween.Valid || isClickHovering)
            {
                editorWindow.Repaint();
            }

            if (Event.current.type == EventType.Repaint)
            {
                isClickHovering = false;
            }

            if (transitionTween.Valid)
            {
                Rect lastElementRect = new Rect(rect.x - (rect.width * (1 - GitAnimation.ApplyEasing(transitionTween.Percent)) * animDir), rect.y, rect.width, rect.height);
                if (lastElement != null && lastElement.IsParent)
                {
                    DrawElementList(lastElementRect, lastElement.children, true);
                }
                else
                {
                    DrawElementList(lastElementRect, elements, false);
                }
                Rect currentElementRect = new Rect(rect.x + (rect.width * GitAnimation.ApplyEasing(transitionTween.Percent)) * animDir, rect.y, rect.width, rect.height);
                if (currentElement != null && currentElement.IsParent)
                {
                    DrawElementList(currentElementRect, currentElement.children, true);
                }
                else
                {
                    DrawElementList(currentElementRect, elements, false);
                }
            }
            else
            {
                if (currentElement != null && currentElement.children != null)
                {
                    DrawElementList(rect, currentElement.children, true);
                }
                else
                {
                    DrawElementList(rect, elements, false);
                }
            }
        }