Ejemplo n.º 1
0
        private void OnStartScale(RectangleTool.ToolCoord pivotCoord, RectangleTool.ToolCoord pickedCoord, Vector2 mousePos, DragMode dragMode, bool rippleTime)
        {
            Bounds selectionBounds = this.selectionBounds;

            this.m_DragMode        = dragMode;
            this.m_Pivot           = base.ToolCoordToPosition(pivotCoord, selectionBounds);
            this.m_Previous        = base.ToolCoordToPosition(pickedCoord, selectionBounds);
            this.m_MouseOffset     = mousePos - this.m_Previous;
            this.m_RippleTime      = rippleTime;
            this.m_RippleTimeStart = selectionBounds.min.x;
            this.m_RippleTimeEnd   = selectionBounds.max.x;
            this.m_CurveEditor.StartLiveEdit();
        }
Ejemplo n.º 2
0
        public Vector2 ToolCoordToPosition(RectangleTool.ToolCoord coord, Bounds bounds)
        {
            Vector2 result;

            switch (coord)
            {
            case RectangleTool.ToolCoord.BottomLeft:
                result = bounds.min;
                break;

            case RectangleTool.ToolCoord.Bottom:
                result = new Vector2(bounds.center.x, bounds.min.y);
                break;

            case RectangleTool.ToolCoord.BottomRight:
                result = new Vector2(bounds.max.x, bounds.min.y);
                break;

            case RectangleTool.ToolCoord.Left:
                result = new Vector2(bounds.min.x, bounds.center.y);
                break;

            case RectangleTool.ToolCoord.Center:
                result = bounds.center;
                break;

            case RectangleTool.ToolCoord.Right:
                result = new Vector2(bounds.max.x, bounds.center.y);
                break;

            case RectangleTool.ToolCoord.TopLeft:
                result = new Vector2(bounds.min.x, bounds.max.y);
                break;

            case RectangleTool.ToolCoord.Top:
                result = new Vector2(bounds.center.x, bounds.max.y);
                break;

            case RectangleTool.ToolCoord.TopRight:
                result = bounds.max;
                break;

            default:
                result = Vector2.zero;
                break;
            }
            return(result);
        }