async scrollToPoint(x, y, duration = 0) {
        const el = this.scrollEl;
        if (duration < 32) {
            if (y != null) {
                el.scrollTop = y;
            }
            if (x != null) {
                el.scrollLeft = x;
            }
            return;
        }
        let resolve;
        let startTime = 0;
        const promise = new Promise(r => resolve = r);
        const fromY = el.scrollTop;
        const fromX = el.scrollLeft;
        const deltaY = y != null ? y - fromY : 0;
        const deltaX = x != null ? x - fromX : 0;
        // scroll loop
        const step = (timeStamp) => {
            const linearTime = Math.min(1, ((timeStamp - startTime) / duration)) - 1;
            const easedT = Math.pow(linearTime, 3) + 1;
            if (deltaY !== 0) {
                el.scrollTop = Math.floor((easedT * deltaY) + fromY);
            }
            if (deltaX !== 0) {
                el.scrollLeft = Math.floor((easedT * deltaX) + fromX);
            }
            if (easedT < 1) {
                // do not use DomController here
                // must use nativeRaf in order to fire in the next frame
                // TODO: remove as any
                requestAnimationFrame(step);
            }
            else {
                resolve();
            }
        };
        // chill out for a frame first
        requestAnimationFrame(ts => {
            startTime = ts;
            step(ts);
        });
        return promise;
    }
/**
     * Scroll to a specified X/Y location in the component.
     *
     * @param x The point to scroll to on the horizontal axis.
     * @param y The point to scroll to on the vertical axis.
     * @param duration The amount of time to take scrolling to that point. Defaults to `0`.
     */
Scroll to a specified X/Y location in the component.
@param x The point to scroll to on the horizontal axis.
@param y The point to scroll to on the vertical axis.
@param duration The amount of time to take scrolling to that point. Defaults to `0`.
Scroll to a specified X / Y location in the component . @param x The point to scroll to on the horizontal axis . @param y The point to scroll to on the vertical axis . @param duration The amount of time to take scrolling to that point . Defaults to ` 0 ` .
async scrollToPoint(x, y, duration = 0) {
        const el = this.scrollEl;
        if (duration < 32) {
            if (y != null) {
                el.scrollTop = y;
            }
            if (x != null) {
                el.scrollLeft = x;
            }
            return;
        }
        let resolve;
        let startTime = 0;
        const promise = new Promise(r => resolve = r);
        const fromY = el.scrollTop;
        const fromX = el.scrollLeft;
        const deltaY = y != null ? y - fromY : 0;
        const deltaX = x != null ? x - fromX : 0;
        const step = (timeStamp) => {
            const linearTime = Math.min(1, ((timeStamp - startTime) / duration)) - 1;
            const easedT = Math.pow(linearTime, 3) + 1;
            if (deltaY !== 0) {
                el.scrollTop = Math.floor((easedT * deltaY) + fromY);
            }
            if (deltaX !== 0) {
                el.scrollLeft = Math.floor((easedT * deltaX) + fromX);
            }
            if (easedT < 1) {
                requestAnimationFrame(step);
            }
            else {
                resolve();
            }
        };
        requestAnimationFrame(ts => {
            startTime = ts;
            step(ts);
        });
        return promise;
    }
async scrollToPoint ( x , y , duration = 0 ) { const el = this . scrollEl ; if ( duration < 32 ) { if ( y != null ) { el . scrollTop = y ; } if ( x != null ) { el . scrollLeft = x ; } return ; } let resolve ; let startTime = 0 ; const promise = new Promise ( r => resolve = r ) ; const fromY = el . scrollTop ; const fromX = el . scrollLeft ; const deltaY = y != null ? y - fromY : 0 ; const deltaX = x != null ? x - fromX : 0 ; const step = ( timeStamp ) => { const linearTime = Math . min ( 1 , ( ( timeStamp - startTime ) / duration ) ) - 1 ; const easedT = Math . pow ( linearTime , 3 ) + 1 ; if ( deltaY !== 0 ) { el . scrollTop = Math . floor ( ( easedT * deltaY ) + fromY ) ; } if ( deltaX !== 0 ) { el . scrollLeft = Math . floor ( ( easedT * deltaX ) + fromX ) ; } if ( easedT < 1 ) { requestAnimationFrame ( step ) ; } else { resolve ( ) ; } } ; requestAnimationFrame ( ts => { startTime = ts ; step ( ts ) ; } ) ; return promise ; }
Scroll to a specified X/Y location in the component.
Scroll to a specified X / Y location in the component .
// scroll loop // do not use DomController here // must use nativeRaf in order to fire in the next frame // TODO: remove as any // chill out for a frame first