(index: number, scrollOptions?: ScrollIntoViewOptions)
| 274 | // ----------------------------------------------------------------------- |
| 275 | |
| 276 | async goToSlide(index: number, scrollOptions?: ScrollIntoViewOptions): Promise<void> { |
| 277 | if (!this.presentation) return |
| 278 | const prev = this.currentSlide |
| 279 | this.currentSlide = Math.max(0, Math.min(index, this.presentation.slides.length - 1)) |
| 280 | if (this.currentSlide !== prev) { |
| 281 | this.emitSlideChange(this.currentSlide) |
| 282 | } |
| 283 | if (this.activeRenderMode === 'slide') { |
| 284 | const { scale, displayWidth, displayHeight } = this.getDisplayMetrics() |
| 285 | this.renderSingleSlide(scale, displayWidth, displayHeight) |
| 286 | } else { |
| 287 | this.suppressScrollChange = true |
| 288 | await new Promise<void>((resolve) => |
| 289 | requestAnimationFrame(() => { |
| 290 | this.suppressScrollChange = false |
| 291 | resolve() |
| 292 | }) |
| 293 | ) |
| 294 | this.ensureListSlideMountedFn?.(this.currentSlide) |
| 295 | const targetChild = this.container.querySelector<HTMLElement>( |
| 296 | `[data-slide-index="${this.currentSlide}"]` |
| 297 | ) |
| 298 | if (targetChild) { |
| 299 | targetChild.scrollIntoView(scrollOptions ?? { behavior: 'smooth', block: 'center' }) |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | async setZoom(percent: number): Promise<void> { |
| 305 | const normalized = this.normalizeZoomPercent(percent) |
no test coverage detected