You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2020/10/15 13:47:54 UTC

[incubator-echarts] 01/01: fix(toolbox): fix incorrect `currentType` in `magictypechanged` event, close #12359.

This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch fix/toolbox
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 560e2ea0d6c8a0beb39deccd1c3e48d3a8ec759e
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu Oct 15 21:39:46 2020 +0800

    fix(toolbox): fix incorrect `currentType` in `magictypechanged` event, close #12359.
---
 src/component/toolbox/feature/MagicType.ts | 9 +++++++--
 test/toolbox-stack-custom.html             | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/component/toolbox/feature/MagicType.ts b/src/component/toolbox/feature/MagicType.ts
index cc2bd60..a3e86a4 100644
--- a/src/component/toolbox/feature/MagicType.ts
+++ b/src/component/toolbox/feature/MagicType.ts
@@ -155,6 +155,7 @@ class MagicType extends ToolboxFeature<ToolboxMagicTypeFeatureOption> {
         );
 
         let newTitle;
+        let currentType = type as TitleType;
         // Change title of stack
         if (type === 'stack') {
             // use titles in model instead of ecModel
@@ -163,12 +164,16 @@ class MagicType extends ToolboxFeature<ToolboxMagicTypeFeatureOption> {
             newTitle = zrUtil.merge({
                 stack: model.option.title.tiled,
                 tiled: model.option.title.stack
-            }, model.option.title)
+            }, model.option.title);
+
+            if (model.get(['iconStatus', type]) !== 'emphasis') {
+                currentType = 'tiled';
+            }
         }
 
         api.dispatchAction({
             type: 'changeMagicType',
-            currentType: type,
+            currentType: currentType,
             newOption: newOption,
             newTitle: newTitle,
             featureName: 'magicType'
diff --git a/test/toolbox-stack-custom.html b/test/toolbox-stack-custom.html
index ad54279..d898d6c 100644
--- a/test/toolbox-stack-custom.html
+++ b/test/toolbox-stack-custom.html
@@ -132,6 +132,9 @@ under the License.
 
             chart.setOption(option, true);
 
+            chart.on('magictypechanged', function (e) {
+                console.log('currentType is', e.currentType);
+            });
         });
     </script>
     <script>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org