Hmm, I hadn't thought about the bubbling not working..
maybe if we change the handleEvent() to something like this (Warning
untested code:)
EventListener.prototype.handleEvent=function(type,e)
if (e.button==3 && (e.type=='mouseup' || e.type=='mousedown')) {
if (this["onrt"+type]) this["onrt"+type](e)
} else {
if (this["on"+type]) this["on"+type](e)
}
}
not sure if that would make the bubbling work ok, it won't change the mouse
events
(same as using simply the button property) but it will still invoke another
event
which can then be created seperatly in the code.
I figure it's better to use different event listeners for different events,
and
right-mouse button should be handled seperatly from a left-mouse button
(it's the
little things in life :)
I'll try the above code and see if it works ok..
Pascal Bestebroer
pa...@dy...
http://www.dynamic-core.net
-----Oorspronkelijk bericht-----
Van: dyn...@li...
[mailto:dyn...@li...]Namens Scott Andrew LePera
Verzonden: zondag 29 oktober 2000 19:21
Aan: dyn...@li...
Onderwerp: Re: [Dynapi-Dev] Scott's mouse events
I think it's a matter of personal preference. In *normal* browser events,
there is no "rtmousedown"; you have to check for the button code anyway and
branch from there.
On the other hand, there are no "onmove" and "ondragend" events either :-)
so there is a case for having special mouse handlers as well.
I guess the one thing I'd mention is that changing the type property also
changes how the event will bubble. If you change "mousedown" to
"onrtmousedown" based on the button, the event will not bubble to other
objects listening for mousedown.
What do the other people on the list think? Is there a way we could have
both?
scottandrew
-----Original Message-----
From: Pascal Bestebroer <pa...@dy...>
To: Dev <dyn...@li...>
Date: Sunday, October 29, 2000 6:18 AM
Subject: [Dynapi-Dev] Scott's mouse events
I like the button property Scott added, but I think it's "cleaner" if you
use different
methods for different mouse buttons.. (making it backward compatible with
the old mouse events)
As a patch you can add these lines :
if (this.button==2) this.type='md'+this.type
if (this.button==3) this.type='rt'+this.type
after the this.button= line in the mouseevents. This makes the event type
rtmouseup or rtmousedown
and also adds the mdmouseup and mdmousedown for the middle-mouse button.
This makes any code using many eventlisteners better to debug, having
different events for different
mouse buttons (and not one event with and if (button=1) code, which is a
bit slower)
Important question: Who's now maintaining the official" version Robert?
Pascal Bestebroer
pa...@dy...
http://www.dynamic-core.net
|