diff --git a/cocos2d/core/components/CCButton.js b/cocos2d/core/components/CCButton.js index d29b11a6da..e29339ab07 100644 --- a/cocos2d/core/components/CCButton.js +++ b/cocos2d/core/components/CCButton.js @@ -333,6 +333,7 @@ var Button = cc.Class({ _registerEvent: function () { this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this); + this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this); this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this); this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this); @@ -383,6 +384,17 @@ var Button = cc.Class({ this._applyState(ButtonState.Pressed); }, + _onTouchMove: function (event) { + var touch = event.touch; + var hit = this.node._hitTest(touch.getLocation()); + if (hit && this._pressed) { + this._applyState(ButtonState.Pressed); + } + else { + this._applyState(ButtonState.Normal); + } + }, + _onTouchEnded: function () { if (this._hovered) { diff --git a/cocos2d/core/components/CCScrollView.js b/cocos2d/core/components/CCScrollView.js index 7ff29bf2aa..49e5d81672 100644 --- a/cocos2d/core/components/CCScrollView.js +++ b/cocos2d/core/components/CCScrollView.js @@ -490,7 +490,9 @@ var ScrollView = cc.Class({ // touch event handler _onTouchBegan: function(event) { var touch = event.touch; - this._handlePressLogic(touch); + if (this.content) { + this._handlePressLogic(touch); + } event.stopPropagation(); }, diff --git a/cocos2d/core/event-manager/CCEventManager.js b/cocos2d/core/event-manager/CCEventManager.js index 4b9b5c5171..5c7d46a448 100644 --- a/cocos2d/core/event-manager/CCEventManager.js +++ b/cocos2d/core/event-manager/CCEventManager.js @@ -284,12 +284,6 @@ cc.eventManager = { var rootEntity = cc.director.getScene(); if(rootEntity) this._sortListenersOfSceneGraphPriority(listenerID, rootEntity); - - // var rootNode = cc.director.getRunningScene(); - // if(rootNode) - // this._sortListenersOfSceneGraphPriority(listenerID, rootNode); - // else - // locFlagMap[listenerID] = this.DIRTY_SCENE_GRAPH_PRIORITY; } } }, diff --git a/cocos2d/core/platform/CCEGLView.js b/cocos2d/core/platform/CCEGLView.js index ae1fc7d443..aa7352d783 100644 --- a/cocos2d/core/platform/CCEGLView.js +++ b/cocos2d/core/platform/CCEGLView.js @@ -52,8 +52,7 @@ cc.__BrowserGetter = { return frame.clientHeight; }, meta: { - "width": "device-width", - "user-scalable": "no" + "width": "device-width" }, adaptationType: cc.sys.browserType }; @@ -744,7 +743,7 @@ cc.EGLView = cc._Class.extend(/** @lends cc.view# */{ */ setRealPixelResolution: function (width, height, resolutionPolicy) { // Set viewport's width - this._setViewportMeta({"width": width, "user-scalable": "no"}, true); + this._setViewportMeta({"width": width}, true); // Set body width to the exact pixel resolution document.body.style.width = width + "px";