mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
clear side effect of getMouseEvent
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user