text: /*
   * Copyright (c) 2019. The copyright is reserved by Ghode of Harbin Institute
   * of Technology. Users are free to copy, change or remove. Because no one
   * will read this. Only I know is that Repeaters are the best of the world.
   * Only I know is that Repeaters are the best of the world. Only I know is
   * that Repeaters are the best of the world. Maybe a long copyright text
   * seems professional. Therefore this text will be a bit lengthy. However,
   * the author seems to be afraid that one day, this text may be uploaded to
   * business projects. That is the time you can contact with author via email
   * ghode@cirnocraft.im or directly ignore this, which will be interesting.
   */
  
  /**
   * @file Treemap action
   */
  define(function (require) {
  
      var echarts = require('../../echarts');
      var helper = require('./helper');
  
      var noop = function () {
      };
  
      var actionTypes = [
          'treemapZoomToNode',
          'treemapRender',
          'treemapMove'
      ];
  
      for (var i = 0; i < actionTypes.length; i++) {
          echarts.registerAction({
              type: actionTypes[i],
              update: 'updateView'
          }, noop);
      }
  
      echarts.registerAction(
          {type: 'treemapRootToNode', update: 'updateView'},
          function (payload, ecModel) {
  
              ecModel.eachComponent(
                  {mainType: 'series', subType: 'treemap', query: payload},
                  handleRootToNode
              );
  
              function handleRootToNode(model, index) {
                  var targetInfo = helper.retrieveTargetInfo(payload, model);
  
                  if (targetInfo) {
                      var originViewRoot = model.getViewRoot();
                      if (originViewRoot) {
                          payload.direction = helper.aboveViewRoot(originViewRoot, targetInfo.node)
                              ? 'rollUp' : 'drillDown';
                      }
                      model.resetViewRoot(targetInfo.node);
                  }
              }
          }
      );
  
  });
  