From 40864171e160a0e25777aa1f5e72a0b980305a5e Mon Sep 17 00:00:00 2001
From: ColinCollins <35832931+ColinCollins@users.noreply.github.com>
Date: Wed, 22 Aug 2018 14:45:14 +0800
Subject: [PATCH 1/2] remove cc.info (#3131)
---
CCDebugger.js | 26 +-------------------------
cocos2d/deprecated.js | 8 ++++++--
test/qunit/unit-es5/_init.js | 1 -
3 files changed, 7 insertions(+), 28 deletions(-)
diff --git a/CCDebugger.js b/CCDebugger.js
index b4bc5ceaf6..2b90045f1f 100644
--- a/CCDebugger.js
+++ b/CCDebugger.js
@@ -163,7 +163,7 @@ cc._initDebugSetting = function (mode) {
};
}
if (mode === cc.DebugMode.INFO_FOR_WEB_PAGE) {
- cc.log = cc.info = function () {
+ cc.log = function () {
logToWebPage(cc.js.formatStr.apply(null, arguments));
};
}
@@ -247,7 +247,6 @@ cc._initDebugSetting = function (mode) {
}
if (CC_EDITOR) {
cc.log = Editor.log;
- cc.info = Editor.info;
}
else if (mode === cc.DebugMode.INFO) {
/**
@@ -276,29 +275,6 @@ cc._initDebugSetting = function (mode) {
return console.log.apply(console, arguments);
};
}
- /**
- * !#en
- * Outputs an informational message to the Cocos Creator Console (editor) or Web Console (runtime).
- * - In Cocos Creator, info is blue.
- * - In Firefox and Chrome, a small "i" icon is displayed next to these items in the Web Console's log.
- * !#zh
- * 输出一条信息消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。
- * - 在 Cocos Creator 中,Info 信息显示是蓝色的。
- * - 在 Firefox 和 Chrome 中,Info 信息有着小 “i” 图标。
- * @method info
- * @param {any} msg - A JavaScript string containing zero or more substitution strings.
- * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
- */
- if (CC_JSB) {
- cc.info = (scriptEngineType === "JavaScriptCore") ? function () {
- (console.info || console.log).apply(console, arguments);
- } : (console.info || console.log);
- }
- else {
- cc.info = function () {
- (console.info || console.log).apply(console, arguments);
- };
- }
}
};
diff --git a/cocos2d/deprecated.js b/cocos2d/deprecated.js
index 81a3b92ebd..d5932d68d0 100644
--- a/cocos2d/deprecated.js
+++ b/cocos2d/deprecated.js
@@ -26,7 +26,7 @@
var js = cc.js;
-if (CC_DEV) {
+if (CC_DEBUG) {
// cc.spriteFrameCache
js.get(cc, "spriteFrameCache", function () {
@@ -229,7 +229,11 @@ if (CC_DEV) {
cc.errorID(1400, 'cc.PI', 'Math.PI');
return Math.PI;
});
-
+ // remove cc.info
+ js.get(cc, 'info', function () {
+ cc.warnID(1400, 'cc.info', 'cc.log');
+ return cc.log;
+ });
if (cc.TiledLayer) {
/**
* Get the Tile set information for the layer.
diff --git a/test/qunit/unit-es5/_init.js b/test/qunit/unit-es5/_init.js
index 847b1dd7da..232b301312 100644
--- a/test/qunit/unit-es5/_init.js
+++ b/test/qunit/unit-es5/_init.js
@@ -156,7 +156,6 @@ cc.engine = new (cc.Class({
Editor.log = cc.log;
Editor.warn = cc.warn;
Editor.error = cc.error;
-Editor.info = cc.info;
Editor.Utils = Editor.Utils || {};
Editor.Utils.UuidCache = {};
From 79542d65dc19c8718cb54c9afa022e8f91855f48 Mon Sep 17 00:00:00 2001
From: Jare Guo
Date: Thu, 23 Aug 2018 17:33:29 +0800
Subject: [PATCH 2/2] fix alignOnce widget not restore after editing animation
(#3139)
---
cocos2d/core/base-ui/CCWidgetManager.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cocos2d/core/base-ui/CCWidgetManager.js b/cocos2d/core/base-ui/CCWidgetManager.js
index 63a3b303c2..51f67021f5 100644
--- a/cocos2d/core/base-ui/CCWidgetManager.js
+++ b/cocos2d/core/base-ui/CCWidgetManager.js
@@ -270,8 +270,9 @@ function refreshScene () {
// check animation editor
if (CC_EDITOR && !Editor.isBuilder) {
var AnimUtils = Editor.require('scene://utils/animation');
- if (AnimUtils) {
- var nowPreviewing = !!AnimUtils.Cache.animation;
+ var EditMode = Editor.require('scene://edit-mode');
+ if (AnimUtils && EditMode) {
+ var nowPreviewing = (EditMode.curMode().name === 'animation' && !!AnimUtils.Cache.animation);
if (nowPreviewing !== animationState.previewing) {
animationState.previewing = nowPreviewing;
if (nowPreviewing) {