Hi list,
I'd like to know if there is a cross-browser way to change the mouse
handler associated to a control.
Context: I want to query the server for a given area. This area may be a
point, a box or a any polygon. The user can choose the type of area with
simple html radiobuttons.
My control is set up with the following draw() method:
draw: function() {
switch (this.handlerType) {
case 'POINT':
this.handler = new OpenLayers.Handler.Point(
this,
{done: this.selectGeom},
{keyMask: this.keyMask}
);
break;
case 'BOX':
this.handler = new OpenLayers.Handler.RegularPolygon(
this,
{done: this.selectGeom},
{keyMask: this.keyMask, sides: 4, irregular: true}
);
break;
...
}
},
I added a custom method in order to set the "handlerType" property:
setHandlerType: function(handlerType) {
this.handlerType = handlerType;
if (this.active) {
this.deactivate();
this.draw();
this.activate();
}
},
All this works pretty fine in Firefox but does not in IE...
The behavior in IE is the following:
- when the control is selected, the default point handler works fine and
the user can click on the map to fire a data request.
- if the user change the handler type (using html radiobuttons and so,
the control setHandlerType method), the mouse handler is lost until the
first click on the map.
Right after the call to setHandlerType(), I expect is to see my new
handler but in IE, there is just no handler. The user needs to click
once on the map and then the handler appears...
Is it simply possible to achieve dynamic replacement of a control
handler? If so, can anyone point me in the right direction?
Regards
Gilles
--
Gilles Bassiere
MAKINA CORPUS
30 rue des Jeuneurs
FR-75002 PARIS
+33 (0) 1 44 82 00 80
http://www.makina-corpus.com
begin:vcard
fn;quoted-printable:Gilles Bassi=C3=A8re
n;quoted-printable:Bassi=C3=A8re;Gilles
org:Makina Corpus;GIS
adr;quoted-printable:;;30 rue des Je=C3=BBneurs;Paris;;FR-75011;France
email;internet:[EMAIL PROTECTED]
title:Web GIS developper
tel;work:+33 (0) 1 44 82 00 80
x-mozilla-html:FALSE
url:http://www.makina-corpus.com
version:2.1
end:vcard
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users