mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge pull request #469 from zilongshanren/improve-button-and-scrollview
Improve button and scrollview
This commit is contained in:
@@ -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();
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user