docs: function calculateRootPosition(layoutInfo, rootRect, targetInfo) {
      if (rootRect) {
          return {x: rootRect.x, y: rootRect.y};
      }
  
      var defaultPosition = {x: 0, y: 0};
      if (!targetInfo) {
          return defaultPosition;
      }
  
      // If targetInfo is fetched by 'retrieveTargetInfo',
      // old tree and new tree are the same tree,
      // so the node still exists and we can visit it.
  
      var targetNode = targetInfo.node;
      var layout = targetNode.getLayout();
  
      if (!layout) {
          return defaultPosition;
      }
  
      // Transform coord from local to container.
      var targetCenter = [layout.width / 2, layout.height / 2];
      var node = targetNode;
      while (node) {
          var nodeLayout = node.getLayout();
          targetCenter[0] += nodeLayout.x;
          targetCenter[1] += nodeLayout.y;
          node = node.parentNode;
      }
  
      return {
          x: layoutInfo.width / 2 - targetCenter[0],
          y: layoutInfo.height / 2 - targetCenter[1]
      };
  }