MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / scrollByPoint

Function scrollByPoint

core/src/utils/content/index.ts:83–95  ·  view source on GitHub ↗
(el: HTMLElement, x: number, y: number, durationMs: number)

Source from the content-addressed store, hash-verified

81 * using the public API `scrollByPoint` with a duration.
82 */
83export 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

Callers 2

scrollContentFunction · 0.90

Calls 2

isIonContentFunction · 0.85
scrollByPointMethod · 0.80

Tested by

no test coverage detected