W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2011

[whatwg] Canvas ScrollBar

From: Bronislav Klučka <Bronislav.Klucka@bauglir.com>
Date: Thu, 20 Oct 2011 16:48:25 +0200
Message-ID: <4EA034B9.20904@bauglir.com>


On 20.10.2011 14:35, Jo?o Eiras wrote:
> On Thu, 20 Oct 2011 14:14:12 +0200, Bronislav Klu?ka 
> <Bronislav.Klucka at bauglir.com> wrote:
>
>> Hello,
>> Would it be possible to extend canvas specification to include scroll 
>> bar functionality? To add scroll bar, to manage scroll bar (total 
>> size, page size). Creating control based on canvas that needs 
>> scrollbar at this point is unnecessarily difficult at this point.
>>
>>
>> Brona Klucka
>
> Which is your use case ?
>
> It doesn't make any sense at all to me to have scrollbars in a canvas. 
> However, if you need scrolling, you can wrap the canvas with an 
> element with specified dimensions and overflow:auto.

Hi,
1/ your solution is very wrong solution.... could you imagine canvas 
100000x100000px? well not possible, only solution is to create smaller 
canvas, wrap it into overflow auto div with inner div and then compute 
the dimension of whole image with javascript and transfer it to inner 
div dimensions (so scrollbars would match) and listen to onScroll event 
of outer div, and  repaint the image with shifted origin

2/ use cases?
a)
diagram modeller
http://www.webnt.cz/demos/033_canvas_diagram/
what if I have some large diagram?

b) how about creating user controls using canvas? (rich controls are 
better doing this way, one has pixel perfect control, full browser 
compatibility) like document viewer, rich listview/treeview control...

Brona Klucka
Received on Thursday, 20 October 2011 07:48:25 UTC

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