mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
Merge pull request #2760 from pandamicro/next
Merge issue fixes from master
This commit is contained in:
@@ -174,7 +174,7 @@ Audio.State = {
|
||||
};
|
||||
|
||||
proto.resume = function () {
|
||||
if (!this._element || this._element.currentTime === 0) return;
|
||||
if (!this._element || this._state === Audio.State.PLAYING) return;
|
||||
this._bindEnded();
|
||||
this._element.play();
|
||||
this._state = Audio.State.PLAYING;
|
||||
|
||||
@@ -328,12 +328,7 @@ var audioEngine = {
|
||||
resume: function (audioID) {
|
||||
var audio = getAudioFromId(audioID);
|
||||
if (audio) {
|
||||
if (audio.getCurrentTime() === 0) {
|
||||
audio.play();
|
||||
}
|
||||
else {
|
||||
audio.resume();
|
||||
}
|
||||
audio.resume();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -263,6 +263,14 @@ var Animation = cc.Class({
|
||||
animator.playState(state, startTime);
|
||||
}
|
||||
|
||||
// Animation cannot be played when the component is not enabledInHierarchy.
|
||||
// That would cause an error for the animation lost the reference after destroying the node.
|
||||
// If users play the animation when the component is not enabledInHierarchy,
|
||||
// we pause the animator here so that it will automatically resume the animation when users enable the component.
|
||||
if (!this.enabledInHierarchy) {
|
||||
animator.pause();
|
||||
}
|
||||
|
||||
this.currentClip = state.clip;
|
||||
}
|
||||
return state;
|
||||
|
||||
@@ -1249,7 +1249,7 @@ var ScrollView = cc.Class({
|
||||
}
|
||||
|
||||
var contentPos = newPosition.sub(this.getContentPosition());
|
||||
this._moveContent(contentPos, reachedEnd);
|
||||
this._moveContent(this._clampDelta(deltaMove), reachedEnd);
|
||||
this._dispatchEvent('scrolling');
|
||||
|
||||
if (!this._autoScrolling) {
|
||||
@@ -1337,7 +1337,6 @@ var ScrollView = cc.Class({
|
||||
this._autoScrollBraking = true;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_calculateTouchMoveVelocity: function() {
|
||||
@@ -1368,7 +1367,6 @@ var ScrollView = cc.Class({
|
||||
|
||||
_moveContent: function(deltaMove, canStartBounceBack) {
|
||||
var adjustedMove = this._flattenVectorByDirection(deltaMove);
|
||||
|
||||
var newPosition = this.getContentPosition().add(adjustedMove);
|
||||
|
||||
this.setContentPosition(newPosition);
|
||||
@@ -1379,10 +1377,8 @@ var ScrollView = cc.Class({
|
||||
if (this.elastic && canStartBounceBack) {
|
||||
this._startBounceBackIfNeeded();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
_getContentLeftBoundary: function() {
|
||||
var contentPos = this.getContentPosition();
|
||||
var leftBoundary = contentPos.x - this.content.getAnchorPoint().x * this.content.getContentSize().width;
|
||||
|
||||
@@ -681,6 +681,14 @@ function initSys () {
|
||||
format: ['.mp3']
|
||||
};
|
||||
}
|
||||
|
||||
var version = /[\d\.]+/.exec(env.system);
|
||||
sys.osVersion = version[0];
|
||||
sys.osMainVersion = parseInt(sys.osVersion);
|
||||
// wechagame subdomain
|
||||
if (!wx.getFileSystemManager) {
|
||||
sys.browserType = sys.BROWSER_TYPE_WECHAT_GAME_SUB;
|
||||
}
|
||||
else {
|
||||
// browser or runtime
|
||||
var win = window, nav = win.navigator, doc = document, docEle = doc.documentElement;
|
||||
|
||||
@@ -1155,8 +1155,11 @@ var BaseNode = cc.Class({
|
||||
var myPrefabInfo = this._prefab;
|
||||
if (myPrefabInfo) {
|
||||
if (newPrefabRoot) {
|
||||
// change prefab
|
||||
_Scene.PrefabUtils.linkPrefab(newPrefabRoot._prefab.asset, newPrefabRoot, this);
|
||||
if (myPrefabInfo.root !== newPrefabRoot) {
|
||||
// change prefab
|
||||
_Scene.PrefabUtils.unlinkPrefab(this);
|
||||
_Scene.PrefabUtils.linkPrefab(newPrefabRoot._prefab.asset, newPrefabRoot, this);
|
||||
}
|
||||
}
|
||||
else if (myPrefabInfo.root !== this) {
|
||||
// detach from prefab
|
||||
|
||||
Reference in New Issue
Block a user