Fix return type should be vec2 instead of simple object for fireball/issues/7898 (#3046)

This commit is contained in:
Knox
2018-08-06 14:52:12 +08:00
committed by pandamicro
parent b520f3c676
commit 111da455d0
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -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;
+4 -4
View File
@@ -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);
};
/**