diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js index d3d4984f68..51946f3bba 100644 --- a/cocos2d/core/CCDirector.js +++ b/cocos2d/core/CCDirector.js @@ -263,7 +263,7 @@ cc.Director = Class.extend(/** @lends cc.Director# */{ var top = box.top + window.pageYOffset - container.clientTop; var x = view._devicePixelRatio * (uiPoint.x - left); var y = view._devicePixelRatio * (top + box.height - uiPoint.y); - return view._isRotated ? {x: view._viewPortRect.width - y, y: x} : {x: x, y: y}; + return view._isRotated ? cc.v2(view._viewportRect.width - y, x) : cc.v2(x, y); }, /** @@ -282,7 +282,7 @@ cc.Director = Class.extend(/** @lends cc.Director# */{ var box = container.getBoundingClientRect(); var left = box.left + window.pageXOffset - container.clientLeft; var top = box.top + window.pageYOffset - container.clientTop; - var uiPoint = {x: 0, y: 0}; + var uiPoint = cc.v2(0, 0); if (view._isRotated) { uiPoint.x = left + glPoint.y / view._devicePixelRatio; uiPoint.y = top + box.height - (view._viewPortRect.width - glPoint.x) / view._devicePixelRatio; diff --git a/cocos2d/core/event-manager/CCEvent.js b/cocos2d/core/event-manager/CCEvent.js index fa781d6355..7d419f1feb 100644 --- a/cocos2d/core/event-manager/CCEvent.js +++ b/cocos2d/core/event-manager/CCEvent.js @@ -103,7 +103,7 @@ proto.setLocation = function (x, y) { * @return {Vec2} location */ proto.getLocation = function () { - return {x: this._x, y: this._y}; + return cc.v2(this._x, this._y); }; /** @@ -113,7 +113,7 @@ proto.getLocation = function () { * @return {Vec2} */ proto.getLocationInView = function() { - return {x: this._x, y: cc.view._designResolutionSize.height - this._y}; + return cc.v2(this._x, cc.view._designResolutionSize.height - this._y); }; proto._setPrevCursor = function (x, y) { @@ -128,7 +128,7 @@ proto._setPrevCursor = function (x, y) { * @return {Vec2} */ proto.getPreviousLocation = function () { - return {x: this._prevX, y: this._prevY}; + return cc.v2(this._prevX, this._prevY); }; /** @@ -138,7 +138,7 @@ proto.getPreviousLocation = function () { * @return {Vec2} */ proto.getDelta = function () { - return {x: this._x - this._prevX, y: this._y - this._prevY}; + return cc.v2(this._x - this._prevX, this._y - this._prevY); }; /**