(el: HTMLElement, x: number, y: number, durationMs: number)
| 81 | * using the public API `scrollByPoint` with a duration. |
| 82 | */ |
| 83 | export const scrollByPoint = (el: HTMLElement, x: number, y: number, durationMs: number) => { |
| 84 | if (isIonContent(el)) { |
| 85 | const content = el as HTMLIonContentElement; |
| 86 | return content.scrollByPoint(x, y, durationMs); |
| 87 | } |
| 88 | return Promise.resolve( |
| 89 | el.scrollBy({ |
| 90 | top: y, |
| 91 | left: x, |
| 92 | behavior: durationMs > 0 ? 'smooth' : 'auto', |
| 93 | }) |
| 94 | ); |
| 95 | }; |
| 96 | |
| 97 | /** |
| 98 | * Prints an error informing developers that an implementation requires an element to be used |
no test coverage detected