当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript path.fromNodeList方法代码示例

本文整理汇总了TypeScript中tree.path.fromNodeList方法的典型用法代码示例。如果您正苦于以下问题:TypeScript path.fromNodeList方法的具体用法?TypeScript path.fromNodeList怎么用?TypeScript path.fromNodeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tree.path的用法示例。


在下文中一共展示了path.fromNodeList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: initiate

  function initiate(fromData) {
    data = fromData;
    tree = treeBuild(treeOps.reconstruct(data.game.treeParts));
    var initialPath = treePath.fromNodeList(treeOps.mainlineNodeList(tree.root));
    // play | try | view
    vm.mode = 'play';
    vm.loading = false;
    vm.round = undefined;
    vm.voted = undefined;
    vm.justPlayed = undefined;
    vm.resultSent = false;
    vm.lastFeedback = 'init';
    vm.initialPath = initialPath;
    vm.initialNode = tree.nodeAtPath(initialPath);

    setPath(treePath.init(initialPath));
    setTimeout(function() {
      jump(initialPath);
      redraw();
    }, 500);

    // just to delay button display
    vm.canViewSolution = false;
    setTimeout(function() {
      vm.canViewSolution = true;
      redraw();
    }, 5000);

    moveTest = moveTestBuild(vm, data.puzzle);

    withGround(function(g) {
      g.setAutoShapes([]);
      g.setShapes([]);
      showGround(g);
    });

    instanciateCeval();

    history.replaceState(null, '', '/training/' + data.puzzle.id);
  };
开发者ID:ddugovic,项目名称:lila,代码行数:40,代码来源:ctrl.ts

示例2: last

export function last(ctrl) {
  var toInit = !treePath.contains(ctrl.vm.path, ctrl.vm.initialPath);
  ctrl.userJump(
    toInit ? ctrl.vm.initialPath : treePath.fromNodeList(ctrl.vm.mainline)
  );
}
开发者ID:ddugovic,项目名称:lila,代码行数:6,代码来源:control.ts

示例3: function


//.........这里部分代码省略.........
          return redraw();
        }
        if (position.chapterId !== data.position.chapterId ||
          !ctrl.tree.pathExists(position.path)) {
          return xhrReload();
        }
        data.position.path = position.path;
        if (who && who.s === sri) return;
        ctrl.userJump(position.path);
        redraw();
      },
      addNode(d) {
        const position = d.p,
        node = d.n,
        who = d.w,
        sticky = d.s;
        setMemberActive(who);
        if (sticky && !vm.mode.sticky) vm.behind++;
        if (wrongChapter(d)) {
          if (sticky && !vm.mode.sticky) redraw();
          return;
        }
        // node author already has the node
        if (sticky && who && who.s === sri) {
          data.position.path = position.path + node.id;
          return;
        }
        const newPath = ctrl.tree.addNode(node, position.path);
        if (!newPath) return xhrReload();
        ctrl.tree.addDests(d.d, newPath, d.o);
        if (sticky) data.position.path = newPath;
        if ((sticky && vm.mode.sticky) || (
          position.path === ctrl.path &&
            position.path === treePath.fromNodeList(ctrl.mainline)
        )) ctrl.jump(newPath);
        redraw();
      },
      deleteNode(d) {
        const position = d.p,
        who = d.w;
        setMemberActive(who);
        if (wrongChapter(d)) return;
        // deleter already has it done
        if (who && who.s === sri) return;
        if (!ctrl.tree.pathExists(d.p.path)) return xhrReload();
        ctrl.tree.deleteNodeAt(position.path);
        if (vm.mode.sticky) ctrl.jump(ctrl.path);
        redraw();
      },
      promote(d) {
        const position = d.p,
        who = d.w;
        setMemberActive(who);
        if (wrongChapter(d)) return;
        if (who && who.s === sri) return;
        if (!ctrl.tree.pathExists(d.p.path)) return xhrReload();
        ctrl.tree.promoteAt(position.path, d.toMainline);
        if (vm.mode.sticky) ctrl.jump(ctrl.path);
      },
      reload: xhrReload,
      changeChapter(d) {
        setMemberActive(d.w);
        if (!vm.mode.sticky) vm.behind++;
        data.position = d.p;
        if (vm.mode.sticky) xhrReload();
        else redraw();
开发者ID:lexisvar,项目名称:lila,代码行数:67,代码来源:studyCtrl.ts

示例4: last

export function last(ctrl: AnalyseCtrl): void {
  ctrl.userJumpIfCan(treePath.fromNodeList(ctrl.mainline));
}
开发者ID:ddugovic,项目名称:lila,代码行数:3,代码来源:control.ts


注:本文中的tree.path.fromNodeList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。