annie.Rectangle Class
Methods
- createFromPoints static
 - createFromRects static
 - destroy
 - isPointIn
 - Rectangle
 - testRectCross
 
Properties
Events
Methods
createFromPoints
    createFromPoints
    
        
            (
            
                - 
                    
                        rect
                    
                
 
            
                - 
                    
                        ary
                    
                
 
            
            
)
        
    
    
    
        
            annie.Rectangle
        
    
    
    
        public
    
    
    
        static
    
    
    
    
    通过一系列点来生成一个矩形 返回包含所有给定的点的最小矩形
Parameters:
| name | type | flag | description | 
|---|---|---|---|
 rect
                        | annie.Point | ||
 ary
                        | ..arg | 
Returns:
createFromRects
    createFromRects
    
        
            (
            
                - 
                    
                        rect
                    
                
 
            
                - 
                    
                        arg
                    
                
 
            
            
)
        
    
    
    
    
    
        public
    
    
    
        static
    
    
    
    
    将多个矩形合成为一个矩形,并将结果存到第一个矩形参数返回
Parameters:
| name | type | flag | description | 
|---|---|---|---|
 rect
                        | annie.Rectangle | ||
 arg
                        | ..arg | 
destroy
    destroy
    
        ()
    
    
    
        
            Void
        
    
    
    
        public
    
    
    
    
    
    
    销毁一个对象 销毁之前一定要做完其他善后工作,否则有可能会出错 特别注意不能在对象自身方法或事件里调用此方法。 比如,不要在显示对象自身的 annie.Event.ON_REMOVE_TO_STAGE 或者其他类似事件调用,一定会报错
Returns:
                
                    
                        Void:
                    
                
            
        isPointIn
    isPointIn
    
        
            (
            
                - 
                    
                        point
                    
                
 
            
            
)
        
    
    
    
        
            Boolean
        
    
    
    
        public
    
    
    
    
    
    
    判断一个点是否在矩形内包括边
Parameters:
| name | type | flag | description | 
|---|---|---|---|
 point
                        | annie.Point | 
Returns:
                
                    
                        Boolean:
                    
                
            
        Rectangle
    Rectangle
    
        
            (
            
                - 
                    
                        x
                    
                
 
            
                - 
                    
                        y
                    
                
 
            
                - 
                    
                        width
                    
                
 
            
                - 
                    
                        height
                    
                
 
            
            
)
        
    
    
    
    
    
    
    
    
    
    
    构造函数
Parameters:
| name | type | flag | description | 
|---|---|---|---|
 x
                        | Number | ||
 y
                        | Number | ||
 width
                        | Number | ||
 height
                        | Number | 
testRectCross
    testRectCross
    
        
            (
            
                - 
                    
                        r1
                    
                
 
            
                - 
                    
                        r2
                    
                
 
            
            
)
        
    
    
    
        
            Boolean
        
    
    
    
        public
    
    
    
    
    
    
    判读两个矩形是否相交
Parameters:
| name | type | flag | description | 
|---|---|---|---|
 r1
                        | Object | ||
 r2
                        | Object | 
Returns:
                
                    
                        Boolean:
                    
                
            
        Properties
height
    Number
    
    
        public
    
    
    
    
    矩形的高度(以像素为单位)
Default:
 0
    
    
    
instanceId
    Number
    
    
        public
    
    
    
    
    每一个annie引擎对象都会有一个唯一的id码。
Example:
 //获取 annie引擎类对象唯一码
 console.log(this.instanceId);
instanceType
    String
    
    
        public
    
    
    
    
    每一个annie类都有一个实例类型字符串,通过这个字符串,你能知道这个实例是从哪个类实例而来
width
    Number
    
    
        public
    
    
    
    
    矩形的宽度(以像素为单位)
Default:
 0
    
    
    
x
    Number
    
    
        public
    
    
    
    
    矩形左上角的 x 坐标
Default:
 0
    
    
    
y
    Number
    
    
        public
    
    
    
    
    矩形左上角的 y 坐标
Default:
 0