UnityEditor.CurveEditorRectangleTool.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( TimeArea timeArea ) : void
timeArea TimeArea
return void
        public override void Initialize(TimeArea timeArea)
        {
            base.Initialize(timeArea);
            this.m_CurveEditor = timeArea as CurveEditor;
            if (this.m_HBarLeft == null)
            {
                this.m_HBarLeft = new AreaManipulator(base.styles.rectangleToolHBarLeft, MouseCursor.ResizeHorizontal);
                this.m_HBarLeft.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_HBarLeft.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartScale(RectangleTool.ToolCoord.Right, RectangleTool.ToolCoord.Left, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.ScaleHorizontal, base.rippleTimeClutch);
                        return true;
                    }
                    return false;
                });
                this.m_HBarLeft.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_HBarLeft.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate));
                    return true;
                });
                this.m_HBarLeft.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_HBarLeft.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndScale();
                    return true;
                });
            }
            if (this.m_HBarRight == null)
            {
                this.m_HBarRight = new AreaManipulator(base.styles.rectangleToolHBarRight, MouseCursor.ResizeHorizontal);
                this.m_HBarRight.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_HBarRight.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartScale(RectangleTool.ToolCoord.Left, RectangleTool.ToolCoord.Right, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.ScaleHorizontal, base.rippleTimeClutch);
                        return true;
                    }
                    return false;
                });
                this.m_HBarRight.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_HBarRight.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate));
                    return true;
                });
                this.m_HBarRight.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_HBarRight.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndScale();
                    return true;
                });
            }
            if (this.m_HBar == null)
            {
                this.m_HBar = new AreaManipulator(base.styles.rectangleToolHBar, MouseCursor.MoveArrow);
                this.m_HBar.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_HBar.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.MoveHorizontal, base.rippleTimeClutch);
                        return true;
                    }
                    return false;
                });
                this.m_HBar.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_HBar.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f));
                    return true;
                });
                this.m_HBar.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_HBar.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndMove();
                    return true;
                });
            }
            if (this.m_VBarBottom == null)
            {
                this.m_VBarBottom = new AreaManipulator(base.styles.rectangleToolVBarBottom, MouseCursor.ResizeVertical);
                this.m_VBarBottom.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_VBarBottom.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartScale(RectangleTool.ToolCoord.Top, RectangleTool.ToolCoord.Bottom, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false);
                        return true;
                    }
                    return false;
                });
                this.m_VBarBottom.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_VBarBottom.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnScaleValue(base.PixelToValue(evt.mousePosition.y));
                    return true;
                });
                this.m_VBarBottom.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_VBarBottom.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndScale();
                    return true;
                });
            }
            if (this.m_VBarTop == null)
            {
                this.m_VBarTop = new AreaManipulator(base.styles.rectangleToolVBarTop, MouseCursor.ResizeVertical);
                this.m_VBarTop.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_VBarTop.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartScale(RectangleTool.ToolCoord.Bottom, RectangleTool.ToolCoord.Top, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false);
                        return true;
                    }
                    return false;
                });
                this.m_VBarTop.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_VBarTop.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnScaleValue(base.PixelToValue(evt.mousePosition.y));
                    return true;
                });
                this.m_VBarTop.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_VBarTop.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndScale();
                    return true;
                });
            }
            if (this.m_VBar == null)
            {
                this.m_VBar = new AreaManipulator(base.styles.rectangleToolVBar, MouseCursor.MoveArrow);
                this.m_VBar.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_VBar.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartMove(new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.MoveVertical, false);
                        return true;
                    }
                    return false;
                });
                this.m_VBar.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_VBar.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnMove(new Vector2(0f, base.PixelToValue(evt.mousePosition.y)));
                    return true;
                });
                this.m_VBar.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_VBar.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndMove();
                    return true;
                });
            }
            if (this.m_SelectionBox == null)
            {
                this.m_SelectionBox = new AreaManipulator(base.styles.rectangleToolSelection, MouseCursor.MoveArrow);
                this.m_SelectionBox.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionBox.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    bool flag = evt.shift || EditorGUI.actionKey;
                    if ((!(Mathf.Approximately(this.selectionBounds.size.x, 0f) && Mathf.Approximately(this.selectionBounds.size.y, 0f)) && !flag) && (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)))
                    {
                        this.OnStartMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), base.PixelToValue(evt.mousePosition.y)), !base.rippleTimeClutch ? DragMode.MoveBothAxis : DragMode.MoveHorizontal, base.rippleTimeClutch);
                        return true;
                    }
                    return false;
                });
                this.m_SelectionBox.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionBox.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), base.PixelToValue(evt.mousePosition.y)));
                    return true;
                });
                this.m_SelectionBox.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionBox.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndMove();
                    return true;
                });
            }
            if (this.m_SelectionScaleLeft == null)
            {
                this.m_SelectionScaleLeft = new AreaManipulator(base.styles.rectangleToolScaleLeft, MouseCursor.ResizeHorizontal);
                this.m_SelectionScaleLeft.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartScale(RectangleTool.ToolCoord.Right, RectangleTool.ToolCoord.Left, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.ScaleHorizontal, base.rippleTimeClutch);
                        return true;
                    }
                    return false;
                });
                this.m_SelectionScaleLeft.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate));
                    return true;
                });
                this.m_SelectionScaleLeft.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndScale();
                    return true;
                });
            }
            if (this.m_SelectionScaleRight == null)
            {
                this.m_SelectionScaleRight = new AreaManipulator(base.styles.rectangleToolScaleRight, MouseCursor.ResizeHorizontal);
                this.m_SelectionScaleRight.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartScale(RectangleTool.ToolCoord.Left, RectangleTool.ToolCoord.Right, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.ScaleHorizontal, base.rippleTimeClutch);
                        return true;
                    }
                    return false;
                });
                this.m_SelectionScaleRight.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate));
                    return true;
                });
                this.m_SelectionScaleRight.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndScale();
                    return true;
                });
            }
            if (this.m_SelectionScaleBottom == null)
            {
                this.m_SelectionScaleBottom = new AreaManipulator(base.styles.rectangleToolScaleBottom, MouseCursor.ResizeVertical);
                this.m_SelectionScaleBottom.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleBottom.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartScale(RectangleTool.ToolCoord.Top, RectangleTool.ToolCoord.Bottom, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false);
                        return true;
                    }
                    return false;
                });
                this.m_SelectionScaleBottom.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleBottom.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnScaleValue(base.PixelToValue(evt.mousePosition.y));
                    return true;
                });
                this.m_SelectionScaleBottom.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleBottom.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndScale();
                    return true;
                });
            }
            if (this.m_SelectionScaleTop == null)
            {
                this.m_SelectionScaleTop = new AreaManipulator(base.styles.rectangleToolScaleTop, MouseCursor.ResizeVertical);
                this.m_SelectionScaleTop.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleTop.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        this.OnStartScale(RectangleTool.ToolCoord.Bottom, RectangleTool.ToolCoord.Top, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false);
                        return true;
                    }
                    return false;
                });
                this.m_SelectionScaleTop.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleTop.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnScaleValue(base.PixelToValue(evt.mousePosition.y));
                    return true;
                });
                this.m_SelectionScaleTop.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleTop.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) {
                    this.OnEndScale();
                    return true;
                });
            }
        }