Merge pull request #469 from zilongshanren/improve-button-and-scrollview

Improve button and scrollview
This commit is contained in:
pandamicro
2016-03-14 10:55:58 +08:00
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -314,6 +314,7 @@ var Button = cc.Class({
},
_onTouchMove: function (event) {
if (!this.interactable || !this.enabledInHierarchy) return;
// mobile phone will not emit _onMouseMoveOut,
// so we have to do hit test when touch moving
var touch = event.touch;
@@ -331,6 +332,8 @@ var Button = cc.Class({
},
_onTouchEnded: function () {
if (!this.interactable || !this.enabledInHierarchy) return;
if (this._pressed) {
cc.Component.EventHandler.emitEvents(this.clickEvents);
}
@@ -339,6 +342,8 @@ var Button = cc.Class({
},
_onTouchCancel: function () {
if (!this.interactable || !this.enabledInHierarchy) return;
this._pressed = false;
this._updateState();
},
+2 -1
View File
@@ -473,8 +473,8 @@ var ScrollView = cc.Class({
if(!this._stopMouseWheel) {
this._handlePressLogic();
this.schedule(this._checkMouseWheel, 0.01);
this._stopMouseWheel = true;
this._checkMouseWheel();
}
event.stopPropagation();
},
@@ -484,6 +484,7 @@ var ScrollView = cc.Class({
if (!cc.pFuzzyEqual(currentOutOfBoundary, cc.p(0, 0), EPSILON)) {
this._processInertiaScroll();
this.unschedule(this._checkMouseWheel);
this._stopMouseWheel = false;
}
},