_onTouchBegan: function (event) {
if (!this.interactable || !this.enabledInHierarchy) return;
this._pressed = true;
this._updateState();
event.stopPropagation();
},
_onTouchMove: function (event) {
if (!this.interactable || !this.enabledInHierarchy || !this._pressed) return;
// mobile phone will not emit _onMouseMoveOut,
// so we have to do hit test when touch moving
var touch = event.touch;
var hit = this.node._hitTest(touch.getLocation());
if(this.transition === Transition.SCALE && this.target) {
if(hit) {
this._fromScale = this._originalScale;
this._toScale = this._originalScale * this.zoomScale;
this._transitionFinished = false;
} else {
this.time = 0;
this._transitionFinished = true;
this.target.scale = this._originalScale;
}
} else {
var state;
if (hit) {
state = 'pressed';
} else {
state = 'normal';
}
this._applyTransition(state);
}
event.stopPropagation();
},
_onTouchEnded: function (event) {
if (!this.interactable || !this.enabledInHierarchy) return;
if (this._pressed) {
cc.Component.EventHandler.emitEvents(this.clickEvents, event);
this.node.emit('click', this);
}
this._pressed = false;
this._updateState();
event.stopPropagation();
},
无意中安卓下发现,手指轻触屏幕不滑动是竟然会触发touchmove的事件,那这样写完全不考虑touchmove真的好吗?
creator版本1.6.0 不知道新版本有没有处理这个问题
手机是小米5



问 

