ACTION-195: mousewheel proposal

Based on discussion by Maciej, Ian and Björn I propose the following for  
the two mousewheel events we want to introduce based on the discussion  
during the SF F2F.

It probably needs some editorial work, but it should be mostly complete.


===
When "mouse wheeling" occurs, the implementation must dispatch a  
<code>mousemultiwheel</code> event implementing the following interface:

interface MouseMultiWheelEvent : MouseEvent {
   readonly attribute long            wheelDeltaX;
   readonly attribute long            wheelDeltaY;
   readonly attribute long            wheelDeltaZ;
   void               initMouseMultiWheelEventNS(in DOMString namespaceURI,
                                                 in DOMString typeArg,
                                                 in boolean canBubbleArg,
                                                 in boolean cancelableArg,
                                                 in views::AbstractView  
viewArg,
                                                 in long detailArg,
                                                 in long screenXArg,
                                                 in long screenYArg,
                                                 in long clientXArg,
                                                 in long clientYArg,
                                                 in unsigned short  
buttonArg,
                                                 in EventTarget  
relatedTargetArg,
                                                 in DOMString modifiersList,
                                                 in long wheelDeltaX,
                                                 in long wheelDeltaY,
                                                 in long wheelDeltaZ);
};

wheelDeltaX is a multiple of 120 (positive means rotated to the right,  
negative means rotated to the left).

wheelDeltaY is a multiple of 120 (positive means rotated away from user or  
to the right, negative means rotated towards user or to the left).

wheelDeltaZ is a multiple of 120 (...).

The default value of wheelDeltaX, wheelDeltaY and wheelDeltaZ is 0.  
UIEvent.detail must always be 0.

XXX: wheelDeltaY -> wheelDelta?

This event includes both scroll deltas. The default action of this event  
is to dispatch a <code>mousewheel</code> event if the y delta is non-zero.  
That event implements the following interface:

interface MouseWheelEvent : MouseEvent {
   readonly attribute long            wheelDelta;
   void               initMouseWheelEventNS(in DOMString namespaceURI,
                                            in DOMString typeArg,
                                            in boolean canBubbleArg,
                                            in boolean cancelableArg,
                                            in views::AbstractView viewArg,
                                            in long detailArg,
                                            in long screenXArg,
                                            in long screenYArg,
                                            in long clientXArg,
                                            in long clientYArg,
                                            in unsigned short buttonArg,
                                            in EventTarget relatedTargetArg,
                                            in DOMString modifiersList,
                                            in long wheelDelta);
};

If the <code>mousewheel</code> event is cancelled, only the default action  
for vertical wheeling is cancelled. The wheelDelta attribute is a multiple  
of 120 (positive means rotated away from the user, negative means rotated  
towards the user). UIEvent.detail is wheelDelta divided by 120. The  
default value of the wheelDelta attribute is 0.

For both <code>mousemultiwheel</code> and <code>mousewheel</code>  
<code>MouseEvent.relatedNode</code> must point to the element being  
wheel'd over or <code>null</code> if there is no such element. (For  
example, when using some device without a pointer but with some way to  
wheel you'd get that.)
===


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Saturday, 24 June 2006 09:10:41 UTC