fix button state error when scroll in scrollview

This commit is contained in:
zilongshanren
2016-06-24 14:36:21 +08:00
parent ac517a4b71
commit a6ebe3ce5f
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -416,6 +416,10 @@ var Button = cc.Class({
event.stopPropagation();
},
_cancelButtonClick: function(){
this._pressed = false;
},
_onTouchCancel: function () {
if (!this.interactable || !this.enabledInHierarchy) return;
+4
View File
@@ -796,6 +796,10 @@ var ScrollView = cc.Class({
//FIXME: touch move delta should be calculated by DPI.
if (cc.pLength(deltaMove) > 7) {
this._touchMoved = true;
var buttonComponent = event.target.getComponent(cc.Button);
if (buttonComponent) {
buttonComponent._cancelButtonClick();
}
}
// TODO: detect move distance, if distance greater than a seuil, then stop propagation.
event.stopPropagation();