(direction: number)
| 563 | } |
| 564 | |
| 565 | nextLayout(direction: number) { |
| 566 | this.layout.onDestroy(); |
| 567 | |
| 568 | let { key } = (this.layout.constructor as LayoutType).state; |
| 569 | if ( |
| 570 | !this.state.layoutStateList.find( |
| 571 | (layoutState) => layoutState.key === key |
| 572 | ) |
| 573 | ) { |
| 574 | key = this.state.layoutStateList[0].key; |
| 575 | } |
| 576 | let nextIndex = |
| 577 | this.state.layoutStateList.findIndex( |
| 578 | (layoutState) => layoutState.key === key |
| 579 | ) + direction; |
| 580 | if (nextIndex < 0) { |
| 581 | nextIndex += this.state.layoutStateList.length; |
| 582 | } |
| 583 | nextIndex = nextIndex % this.state.layoutStateList.length; |
| 584 | // Get the next layout available |
| 585 | const newLayoutState = this.state.layoutStateList[nextIndex]; |
| 586 | this.setLayoutByKey(newLayoutState.key); |
| 587 | } |
| 588 | |
| 589 | setLayoutByKey(layoutKey: string) { |
| 590 | logAssert(!this.destroyed, 'Workspace is destroyed'); |
no test coverage detected