Skip to content

Commit

Permalink
Merge pull request cocos#2504 from cocos-creator/v1.9
Browse files Browse the repository at this point in the history
sync branch
  • Loading branch information
jareguo authored Apr 4, 2018
2 parents 3210895 + c2304a0 commit d6332ae
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
55 changes: 32 additions & 23 deletions cocos2d/core/platform/BKInputManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,42 +367,50 @@ if (CC_QQPLAY) {

// bk game
detectGesture: function () {
var touchArr = BK.TouchEvent.getTouchEvent();
if (!touchArr) {
var allTouchArr = BK.TouchEvent.getAllTouchEvent();
if (!allTouchArr) {
return;
}

var _touchBeginEvents = [];
var _touchMoveEvents = [];
var _touchEndEvents = [];

for (var i = 0; i < touchArr.length; i++) {
var touch_event = touchArr[i];
//touch begin
if (touchArr[i].status === 2) {
_touchBeginEvents.push(touch_event);
var touchArr = allTouchArr;
for(var i = 0; i < touchArr.length; i++) {
_touchBeginEvents.length = 0;
_touchMoveEvents.length = 0;
_touchEndEvents.length = 0;

for (var j = 0; j < touchArr[i].length; ++j) {

var touch_event = touchArr[i][j];
//touch begin
if (touch_event.status === 2) {
_touchBeginEvents.push(touch_event);
}
//touch moved
else if (touch_event.status === 3) {
_touchMoveEvents.push(touch_event);
}
//touch end
else if (touch_event.status === 1) {
_touchEndEvents.push(touch_event);
}
}
//touch moved
else if (touchArr[i].status === 3) {
_touchMoveEvents.push(touch_event);

if (_touchBeginEvents.length > 0) {
this.handleTouchesBegin(this.getTouchesByEvent(_touchBeginEvents));
}
//touch end
else if (touchArr[i].status === 1) {
_touchEndEvents.push(touch_event);
if (_touchMoveEvents.length > 0) {
this.handleTouchesMove(this.getTouchesByEvent(_touchMoveEvents));
}
if (_touchEndEvents.length > 0) {
this.handleTouchesEnd(this.getTouchesByEvent(_touchEndEvents));
}
}

if (_touchBeginEvents.length > 0) {
this.handleTouchesBegin(this.getTouchesByEvent(_touchBeginEvents));
}
if (_touchMoveEvents.length > 0) {
this.handleTouchesMove(this.getTouchesByEvent(_touchMoveEvents));
}
if (_touchEndEvents.length > 0) {
this.handleTouchesEnd(this.getTouchesByEvent(_touchEndEvents));
}

BK.TouchEvent.updateTouchStatus();
},

/**
Expand All @@ -417,6 +425,7 @@ if (CC_QQPLAY) {
width: element.width,
height: element.height
};
BK.Script.getTouchModeAll = 1;
},

_registerKeyboardEvent: function () {
Expand Down
10 changes: 6 additions & 4 deletions cocos2d/particle/CCSGParticleSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,17 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
}
},

_createRenderCmd: function(){
_createRenderCmd: function () {
if(cc._renderType === cc.game.RENDER_TYPE_CANVAS)
return new _ccsg.ParticleSystem.CanvasRenderCmd(this);
else
return new _ccsg.ParticleSystem.WebGLRenderCmd(this);
},

onEnter: function () {
// udpate after action in run!
this.scheduleUpdateWithPriority(1);
_ccsg.Node.prototype.onEnter.call(this);
},
/**
* This is a hack function for performance, it's only available on Canvas mode. <br/>
* It's very expensive to change color on Canvas mode, so if set it to true, particle system will ignore the changing color operation.
Expand Down Expand Up @@ -1365,8 +1369,6 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
// colorModulate = YES;
this.autoRemoveOnFinish = false;

// udpate after action in run!
this.scheduleUpdateWithPriority(1);
this._renderCmd._initWithTotalParticles(numberOfParticles);
return true;
},
Expand Down
3 changes: 2 additions & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"name": "ScrollView",
"entries": [
"./cocos2d/core/components/CCScrollView.js"
]
],
"dependencies": ["Layout"]
},
{
"name": "Toggle",
Expand Down

0 comments on commit d6332ae

Please sign in to comment.