Proposal: Exposing native scroll as API

guest271314 guest271314 at gmail.com
Fri Jun 21 14:43:08 UTC 2019


Not following what

> if it was in place of

is intended to mean?

It is currently possibble to scroll to any portion of the viewport and get
the current position of any element during `scroll` event.

What is being proposed that is not already possible?

On Fri, Jun 21, 2019 at 2:30 PM Adam Eisenreich <akxe at seznam.cz> wrote:

> I mean, that there should be an API that would say, how an element would
> scroll, if it was in place of for example a `<canvas>`.
>
>
> ```
> const scrollArea = new ScrollArea(canvasElement, {
>   borderBox: 'unlimited', // Default would be the element
>   //viewPort: '100#200'
> });
>
> scrollArea.addEventLisener('scrollStart', event => {
>   console.log(event.endOffsetPosition);
>   console.log(event.currenOffset);
>   console.log(event.deltaX);
>   // Possibly others
> });
> scrollArea.addEventLisener('scroll', () => {});
> scrollArea.addEventLisener('scrollEnd', () => {});
> ```
> Or,
> ```
> function step(timestamp) {
>   canvas.translate(scrollArea.currentOffset.top,
> scrollArea.currentOffset.left);
>   requestAnimationFrame(step);
> }
>
> requestAnimationFrame(step);
> ```
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190621/caf86798/attachment-0001.html>


More information about the es-discuss mailing list