clear side effect of getMouseEvent

This commit is contained in:
Jare Guo
2017-08-11 18:20:01 +08:00
parent 0011e6e3c0
commit bb940ee0f4
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -317,12 +317,12 @@ var inputManager = {
*/
getMouseEvent: function(location, pos, eventType){
var locPreMouse = this._prevMousePoint;
this._glView._convertMouseToLocationInView(location, pos);
var mouseEvent = new cc.Event.EventMouse(eventType);
mouseEvent.setLocation(location.x, location.y);
mouseEvent._setPrevCursor(locPreMouse.x, locPreMouse.y);
locPreMouse.x = location.x;
locPreMouse.y = location.y;
this._glView._convertMouseToLocationInView(locPreMouse, pos);
mouseEvent.setLocation(locPreMouse.x, locPreMouse.y);
return mouseEvent;
},
+3 -3
View File
@@ -967,10 +967,10 @@ var View = cc._Class.extend({
return this._isRotated ? {x: this._viewPortRect.width - y, y: x} : {x: x, y: y};
},
_convertMouseToLocationInView: function (point, relatedPos) {
_convertMouseToLocationInView: function (in_out_point, relatedPos) {
var viewport = this._viewPortRect, _t = this;
point.x = ((_t._devicePixelRatio * (point.x - relatedPos.left)) - viewport.x) / _t._scaleX;
point.y = (_t._devicePixelRatio * (relatedPos.top + relatedPos.height - point.y) - viewport.y) / _t._scaleY;
in_out_point.x = ((_t._devicePixelRatio * (in_out_point.x - relatedPos.left)) - viewport.x) / _t._scaleX;
in_out_point.y = (_t._devicePixelRatio * (relatedPos.top + relatedPos.height - in_out_point.y) - viewport.y) / _t._scaleY;
},
_convertPointWithScale: function (point) {