W3C home > Mailing lists > Public > public-webapi@w3.org > February 2006

Re: ISSUE-30: mousewheel event

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 28 Feb 2006 15:56:52 -0800
Message-ID: <4404E344.1050401@sicking.cc>
To: Matthew Raymond <mattraymond@earthlink.net>
Cc: Anne van Kesteren <annevk@opera.com>, "Web APIs WG (public)" <public-webapi@w3.org>

Matthew Raymond wrote:
> Anne van Kesteren wrote:
>> On Sun, 26 Feb 2006 06:55:48 +0100, Matthew Raymond  
>> <mattraymond@earthlink.net> wrote:
>>> If the wheel doesn't scroll, why would you want it to trigger the
>>> event in the first place???
>> So you can use it for zooming instead. (If there is a scrollbar you could  
>> do this by canceling the event...)
> 
>    I don't get it. While you may use the mouse wheel for the purpose of
> zooming, the event it should trigger should be something like
> "mousezoom". 

No, this would amount to way too many events. Basically you'd get N*M 
events where N is the number of input devices (stylus pens, keyboard, 
mouse, etc) and M is the number of things they can do (scroll, zoom, click).

This is, of course, undesirable.

What is being proposed is this: The 'mousewheel' event is an event 
similar to 'mouseclick' or 'keydown'. It is fired in response to the 
user using a 'wheel' on his/her mouse.

When the event has fired (assuming preventDefault() wasn't called) the 
UA will perform an action associated with the mousewheel. In many UAs 
today that will scroll the displayed page. In response to this scrolling 
a 'scroll' event is fired. If the UA had instead been configured to zoom 
in response to the wheel a 'zoom' event might fire.

This is exactly like how things work when you use the mouse buttons. 
When the user clicks the mousebutton over a <input type=submit> element 
a 'click' event is fired and then a 'submit' event in response to the 
'click'.


This way, someone interested in using the mousewheel to for example 
control a character in a game will just have to listen to the 
'mousewheel' event and call .preventDefault() on it. It does not have to 
worry about if the UA would normally scroll, zoom or do something else.

Similarly, someone that is interested in reacting to scrolling will just 
have to listen to the 'scroll' event and doesn't have to care if the 
scrolling came from an arrow-key keyboard press, a mousewheel roll, or a 
mouseclick on the scrollbar.


I hope this clears up the confusion that seems to exist.

/ Jonas
Received on Tuesday, 28 February 2006 23:56:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:53 GMT