Merge pull request #216 from pandamicro/v0.7

Roll back some mistaken changes to Button/ScrollView, my bad
This commit is contained in:
pandamicro
2016-01-11 10:44:45 +08:00
4 changed files with 17 additions and 10 deletions
+12
View File
@@ -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)
{
+3 -1
View File
@@ -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();
},
@@ -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;
}
}
},
+2 -3
View File
@@ -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";