W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2012

[whatwg] Supporting scrollTop and scrollLeft on the Canvas element

From: Charles Pritchard <chuck@jumis.com>
Date: Sat, 04 Feb 2012 10:21:32 -0800
Message-ID: <4F2D772C.5080600@jumis.com>
On 2/4/12 12:30 AM, Anne van Kesteren wrote:
> On Tue, 31 Jan 2012 23:35:45 +0100, Charles Pritchard 
> <chuck at jumis.com> wrote:
>> I'd like to see scrollTop and scrollLeft supported for the Canvas 
>> element. They would simply fire an onscroll event on the element, and 
>> do nothing else.
>> Many Canvas UIs use only one visible canvas layer, or otherwise, one 
>> main canvas layer.
>
> That would require special casing <canvas> in 
> http://dev.w3.org/csswg/cssom-view/#scroll-an-element which I'm not 
> sure is a good idea. Why don't you just dispatch a synthetic scroll 
> event?
>

Does the scroll event carry x/y information?

I agree, this is a special case for canvas -- the precedent set by 
<input type=text> is that form controls may have separate scroll semantics.

My proposal is not thought-out all the way, but I'm hoping it can float.

The idea here is to enable scroll with limited height/width canvas layer 
to work well.

This is going to be useful for context.scrollPathIntoView as well as 
simply running Element.scrollIntoView on elements within the Canvas 
sub-tree.

Currently, the scroll* attributes in Canvas are read only and set to 
zero. So, I think there is room to support them in the future.

-Charles
Received on Saturday, 4 February 2012 10:21:32 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:39 UTC