本文整理汇总了TypeScript中app/model/paths.PathUtil.sortPathOps方法的典型用法代码示例。如果您正苦于以下问题:TypeScript PathUtil.sortPathOps方法的具体用法?TypeScript PathUtil.sortPathOps怎么用?TypeScript PathUtil.sortPathOps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app/model/paths.PathUtil
的用法示例。
在下文中一共展示了PathUtil.sortPathOps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const applySplitsFn = (path: Path, gapGroups: ReadonlyTable<CmdInfo>) => {
const splitOps: Array<{
readonly subIdx: number;
readonly cmdIdx: number;
readonly ts: number[];
}> = [];
const numPaths = path.getSubPath(subIdx).getCommands().length;
for (let i = gapGroups.length - 1; i >= 0; i--) {
const gapGroup = gapGroups[i];
// Clamp the index between 1 and numCommands - 1 to account for cases
// where the alignment algorithm attempts to append new commands to the
// front and back of the sequence.
const cmdIdx = _.clamp(_.last(gapGroup).nextCmdIdx, 1, numPaths - 1);
const ts = gapGroup.map((unused, gapIdx) => (gapIdx + 1) / (gapGroup.length + 1));
splitOps.push({ subIdx, cmdIdx, ts });
}
PathUtil.sortPathOps(splitOps);
const mutator = path.mutate();
for (const { cmdIdx, ts } of splitOps) {
mutator.splitCommand(subIdx, cmdIdx, ...ts);
}
return mutator.build();
};
示例2:
unsplitOpsMap.forEach((ops, idx) => {
PathUtil.sortPathOps(ops);
ops.forEach(op => pm.unsplitCommand(op.subIdx, op.cmdIdx));
});