[OpenLayers-Users] Strange IE7 thingy
Barry Hunter
barry at barryhunter.co.uk
Thu Oct 11 11:59:31 EDT 2007
Just to say I have spotted similar thing :(
I ended up just commenting out the isLeftClick as I dont really care
which button it is (this is in an extension of defaultClick in
MouseDefaults Control)
As an exercise I echoed out the values of which and button and got
prompt('',"evt.which="+evt.which+"; evt.button="+evt.button);
Gives:
evt.which=undefined; evt.button=0
according to http://unixpapa.com/js/mouse.html, button should be 1.
They also suggest
if (event.which == null)
/* IE case */
button= (event.button < 2) ? "LEFT" :
((event.button == 4) ? "MIDDLE" : "RIGHT");
else
/* All others */
button= (event.which < 2) ? "LEFT" :
((event.which == 2) ? "MIDDLE" : "RIGHT");
which does get it right on my IE7 (and Firefox at least)
Barry
(if it makes a difference see it here: http://www.geograph.org.uk/mapper/ )
On 9/7/07, huub fleuren <huub.fleuren at geodan.nl> wrote:
> Hi
> list
>
> In IE7 is see the strangest thing:
>
> in Events.js it reads
>
> isLeftClick : function(event) {
> return (((event.which) && (event.which == 1)) ||
> ((event.button) && (event.button == 1)));
>
> },
>
> in my app it's
>
> if(OpenLayers.Events.isLeftClick(e)) {// do}
>
> In IE this doesn't go, in FF it does go
>
> I checked the values: in isLeftClick
> alert (((event.which) && (event.which == 1)) ||
> ((event.button) && (event.button == 1)));
> displays true (if leftclicked...)
>
> In IE7 alert(OpenLayers.Events.isLeftClick(e)) displays 0 (always: e.g.
> if i check with event.button == 2) )
>
> I changed to the following greasy construction
>
> isLeftClick : function(event) {
> if (((event.which) && (event.which == 1)) ||
> ((event.button) && (event.button == 1)));
> return true
> return false
> },
>
> this works also in IE7
>
> Now isn't that the strangest thing?
>
> Regards,
> Huub
>
> --
> =====================================
> Geodan IT b.v.
> Buitenhaven 27-A
> 5211 TP 's-Hertogenbosch (NL)
> -------------------------------------
> Tel: +31 (0)73 - 692 5151
> Fax: +31 (0)73 - 692 5150
> Mobiel:
> -------------------------------------
> Postadres / mailing address
> President Kennedylaan 1
> 1079 MB Amsterdam (NL)
> -------------------------------------
> E-mail: huub.fleuren at geodan.nl
> Website: www.geodan.nl
> Disclaimer: www.geodan.nl/disclaimer
> -------------------------------------
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
Barry
- www.nearby.org.uk - www.geograph.org.uk -
More information about the Users
mailing list