本文整理汇总了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);
};
示例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)
);
}
示例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();
示例4: last
export function last(ctrl: AnalyseCtrl): void {
ctrl.userJumpIfCan(treePath.fromNodeList(ctrl.mainline));
}