mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
Vec2, Rect and Size could be inited by null
This commit is contained in:
@@ -15,7 +15,7 @@ var JS = require('../platform/js');
|
||||
* @param {Number} [h=0]
|
||||
*/
|
||||
function Rect (x, y, w, h) {
|
||||
if (typeof x === 'object') {
|
||||
if (x && typeof x === 'object') {
|
||||
y = x.y;
|
||||
w = x.width;
|
||||
h = x.height;
|
||||
|
||||
@@ -10,7 +10,7 @@ var JS = require('../platform/js');
|
||||
* @see cc.size
|
||||
*/
|
||||
function Size (width, height) {
|
||||
if (typeof width === 'object') {
|
||||
if (width && typeof width === 'object') {
|
||||
height = width.height;
|
||||
width = width.width;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ var FireClass = require('../platform/CCClass');
|
||||
* @param {number} [y=0]
|
||||
*/
|
||||
function Vec2 (x, y) {
|
||||
if (typeof x === 'object') {
|
||||
if (x && typeof x === 'object') {
|
||||
y = x.y;
|
||||
x = x.x;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user