Beispiel #1
0
        public TimeAreaItem(GUIStyle style, Action <double> onDrag)
        {
            m_Style   = style;
            headColor = Color.white;
            var scrub = new Scrub(
                (evt, state) =>
            {
                firstDrag = true;
                return(state.timeAreaRect.Contains(evt.mousePosition) && bounds.Contains(evt.mousePosition));
            },
                (d) =>
            {
                if (onDrag != null)
                {
                    onDrag(d);
                }
                firstDrag = false;
            },
                () =>
            {
                showTooltip = false;
                firstDrag   = false;
            }
                );

            AddManipulator(scrub);
            lineColor   = m_Style.normal.textColor;
            drawLine    = true;
            drawHead    = true;
            canMoveHead = false;
            tooltip     = string.Empty;
            boundOffset = Vector2.zero;
            m_Tooltip   = new Tooltip(DirectorStyles.Instance.displayBackground, DirectorStyles.Instance.tinyFont);
        }
        public TimeAreaItem(GUIStyle style, Action <double, bool> onDrag)
        {
            this.m_Style    = style;
            this.dottedLine = false;
            this.headColor  = Color.get_white();
            Scrub m = new Scrub(onDrag);

            base.AddManipulator(m);
            this.lineColor   = this.m_Style.get_normal().get_textColor();
            this.drawLine    = true;
            this.drawHead    = true;
            this.canMoveHead = false;
            this.tooltip     = string.Empty;
            this.alignment   = TimeAreaItem.Alignment.Center;
            this.boundOffset = Vector2.get_zero();
            this.m_Tooltip   = new Tooltip(DirectorStyles.Instance.displayBackground, DirectorStyles.Instance.tinyFont);
            base.MouseUp    += delegate(object target, Event evt, TimelineWindow.TimelineState state)
            {
                if (evt.get_button() == 0 && this.showTooltip)
                {
                    this.showTooltip = false;
                }
                return(false);
            };
        }