()
| 492 | } |
| 493 | |
| 494 | private async loadAnimation(): Promise<void> { |
| 495 | // Menu swipe animation takes the menu's inner width as parameter, |
| 496 | // If `offsetWidth` changes, we need to create a new animation. |
| 497 | const width = this.menuInnerEl!.offsetWidth; |
| 498 | /** |
| 499 | * Menu direction animation is calculated based on the document direction. |
| 500 | * If the document direction changes, we need to create a new animation. |
| 501 | */ |
| 502 | const isEndSide = isEnd(this.side); |
| 503 | if (width === this.width && this.animation !== undefined && isEndSide === this.isEndSide) { |
| 504 | return; |
| 505 | } |
| 506 | this.width = width; |
| 507 | this.isEndSide = isEndSide; |
| 508 | |
| 509 | // Destroy existing animation |
| 510 | if (this.animation) { |
| 511 | this.animation.destroy(); |
| 512 | this.animation = undefined; |
| 513 | } |
| 514 | // Create new animation |
| 515 | const animation = (this.animation = await menuController._createAnimation(this.type!, this)); |
| 516 | if (!config.getBoolean('animated', true)) { |
| 517 | animation.duration(0); |
| 518 | } |
| 519 | animation.fill('both'); |
| 520 | } |
| 521 | |
| 522 | private async startAnimation(shouldOpen: boolean, animated: boolean): Promise<void> { |
| 523 | const isReversed = !shouldOpen; |
no test coverage detected