Skip to content

Commit 7dced1a

Browse files
committed
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-html5 into Iss2227_SyncScrollView
2 parents 235e061 + ec83d34 commit 7dced1a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

cocos2d/touch_dispatcher/CCMouseDispatcher.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,12 @@ cc.MouseDispatcher = cc.Class.extend({
434434
},
435435

436436
_findHandler:function (delegate) {
437-
for (i = 0; i < this._mouseDelegateHandlers.length; i++) {
437+
for (var i = 0; i < this._mouseDelegateHandlers.length; i++) {
438438
if (this._mouseDelegateHandlers[i] && this._mouseDelegateHandlers[i].getDelegate() == delegate) {
439439
return this._mouseDelegateHandlers[i];
440440
}
441441
}
442+
return null;
442443
},
443444

444445
setPriority:function (priority, delegate) {
@@ -468,8 +469,7 @@ cc.MouseDispatcher = cc.Class.extend({
468469
if (mouseObj.getButton() == cc.MOUSE_RIGHTBUTTON) {
469470
if (handler.getDelegate().onRightMouseDown)
470471
handler.getDelegate().onRightMouseDown(mouseObj);
471-
}
472-
else {
472+
} else {
473473
if (handler.getDelegate().onMouseDown)
474474
handler.getDelegate().onMouseDown(mouseObj);
475475
}
@@ -478,8 +478,7 @@ cc.MouseDispatcher = cc.Class.extend({
478478
if (mouseObj.getButton() == cc.MOUSE_RIGHTBUTTON) {
479479
if (handler.getDelegate().onRightMouseUp)
480480
handler.getDelegate().onRightMouseUp(mouseObj);
481-
}
482-
else {
481+
} else {
483482
if (handler.getDelegate().onMouseUp)
484483
handler.getDelegate().onMouseUp(mouseObj);
485484
}

cocos2d/touch_dispatcher/CCTouchDispatcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ cc.TouchDispatcher = cc.Class.extend(/** @lends cc.TouchDispatcher# */ {
363363
if (cc.Browser.isMobile) {
364364
if (handler.getDelegate().onTouchMoved) handler.getDelegate().onTouchMoved(touch, event);
365365
} else {
366-
if (this._mousePressed) if (handler.getDelegate().onTouchMoved) handler.getDelegate().onTouchMoved(touch, event);
366+
if (this._mousePressed && handler.getDelegate().onTouchMoved) handler.getDelegate().onTouchMoved(touch, event);
367367
}
368368
break;
369369
case cc.TOUCH_ENDED:
@@ -411,7 +411,7 @@ cc.TouchDispatcher = cc.Class.extend(/** @lends cc.TouchDispatcher# */ {
411411
if (cc.Browser.isMobile) {
412412
if (handler.getDelegate().onTouchesMoved) handler.getDelegate().onTouchesMoved(mutableTouches, event);
413413
} else {
414-
if (this._mousePressed) if (handler.getDelegate().onTouchesMoved) handler.getDelegate().onTouchesMoved(mutableTouches, event);
414+
if (this._mousePressed && handler.getDelegate().onTouchesMoved) handler.getDelegate().onTouchesMoved(mutableTouches, event);
415415
}
416416
}
417417
break;

0 commit comments

Comments
 (0)