How to use the @antv/g6.Util.isString function in @antv/g6

To help you get started, we’ve selected a few @antv/g6 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G6 / plugins / radial / index.js View on Github external
return;
    } else if (nodes.length === 1) {
      nodes[0].x = center[0];
      nodes[0].y = center[1];
      return;
    }
    const linkDistance = self.get('linkDistance');
    const unitRadius = self.get('unitRadius');

    // 如果正在布局,忽略布局请求
    if (self.isTicking()) {
      return;
    }
    // layout
    let focusNode = self.get('focusNode');
    if (Util.isString(focusNode)) {
      let found = false;
      for (let i = 0; i < nodes.length; i++) {
        if (nodes[i].id === focusNode) {
          focusNode = nodes[i];
          self.set('focusNode', focusNode);
          found = true;
          i = nodes.length;
        }
      }
      if (!found) focusNode = null;
    }
    // default focus node
    if (!focusNode) {
      focusNode = nodes[0];
      if (!focusNode) return;
      self.set('focusNode', focusNode);
github antvis / G6 / plugins / mds / index.js View on Github external
const center = self.get('center');
    const nodes = data.nodes;
    if (nodes.length === 0) return;
    else if (nodes.length === 1) {
      nodes[0].x = center[0];
      nodes[0].y = center[1];
    }
    const linkDistance = self.get('linkDistance');

    // 如果正在布局,忽略布局请求
    if (self.isTicking()) {
      return;
    }
    // layout
    let focusNode = self.get('focusNode');
    if (Util.isString(focusNode)) {
      let found = false;
      for (let i = 0; i < nodes.length; i++) {
        if (nodes[i].id === focusNode) {
          focusNode = nodes[i];
          self.set('focusNode', focusNode);
          found = true;
          i = nodes.length;
        }
      }
      if (!found) focusNode = null;
    }
    // default focus node
    if (!focusNode) {
      focusNode = nodes[0];
      if (!focusNode) return;
      self.set('focusNode', focusNode);
github guozhaolong / wfd / src / shape / subProcess.js View on Github external
cfg.content.edges.forEach(edgeCfg => {
          let source = edgeCfg.source;
          let target = edgeCfg.target;
          if (source && Util.isString(source)) {
            source = group.findById(source);
            source = source.get('item');
          }
          if (target && Util.isString(target)) {
            target = group.findById(target);
            target = target.get('item');
          }
          const edgeContainer = group.addGroup();
          const edge = new Edge({
            group: edgeContainer,
            capture: false,
            source,
            target,
            id: edgeCfg.id,
            model: {
              ...edgeCfg,
github guozhaolong / wfd / src / shape / subProcess.js View on Github external
cfg.content.edges.forEach(edgeCfg => {
          let source = edgeCfg.source;
          let target = edgeCfg.target;
          if (source && Util.isString(source)) {
            source = group.findById(source);
            source = source.get('item');
          }
          if (target && Util.isString(target)) {
            target = group.findById(target);
            target = target.get('item');
          }
          const edgeContainer = group.addGroup();
          const edge = new Edge({
            group: edgeContainer,
            capture: false,
            source,
            target,
            id: edgeCfg.id,
            model: {
              ...edgeCfg,
              shape: 'flow-polyline-round',
            },
          });
          edge.toFront();