| 548 | } |
| 549 | |
| 550 | sortFromId(id) { |
| 551 | switch (id) { |
| 552 | case "time": |
| 553 | return (c1, c2) => { |
| 554 | if (c1.ticks < c2.ticks) return 1; |
| 555 | else if (c1.ticks > c2.ticks) return -1; |
| 556 | return c2.ownTicks - c1.ownTicks; |
| 557 | }; |
| 558 | case "own-time": |
| 559 | return (c1, c2) => { |
| 560 | if (c1.ownTicks < c2.ownTicks) return 1; |
| 561 | else if (c1.ownTicks > c2.ownTicks) return -1; |
| 562 | return c2.ticks - c1.ticks; |
| 563 | }; |
| 564 | case "category-time": |
| 565 | return (c1, c2) => { |
| 566 | if (c1.type === c2.type) return c2.ticks - c1.ticks; |
| 567 | if (c1.type < c2.type) return 1; |
| 568 | return -1; |
| 569 | }; |
| 570 | case "category-own-time": |
| 571 | return (c1, c2) => { |
| 572 | if (c1.type === c2.type) return c2.ownTicks - c1.ownTicks; |
| 573 | if (c1.type < c2.type) return 1; |
| 574 | return -1; |
| 575 | }; |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | expandTree(tree, indent) { |
| 580 | let index = 0; |