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


TypeScript PathUtil.sortPathOps方法代码示例

本文整理汇总了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();
 };
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:23,代码来源:AutoAwesome.ts

示例2:

 unsplitOpsMap.forEach((ops, idx) => {
   PathUtil.sortPathOps(ops);
   ops.forEach(op => pm.unsplitCommand(op.subIdx, op.cmdIdx));
 });
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:4,代码来源:actionmode.service.ts


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