[OpenLayers-Users] Handler problems

Tom (JDi Solutions) tom.dean at jdi-solutions.co.uk
Tue Sep 4 04:39:08 EDT 2007


Looks like this is a bug in OpenLayers.

It works fine in IE6 & IE7.  Only FF shows this bug.

2 example pages show this working and not working:

Here is a slight adaptation of the examples/custom-control.html file.  The
only difference from the original being that instead of alerting the results
it displays them in a div immediately below the map div.  It works
perfectly.  :)
http://demo.jdi-consult.net/oltest/custom-control-box.html

In this example there is one further change from the example above.  The
handler has been changed from Box to Point.  Now if you shift click the map
the co-ords are displayed below the map as before, if you then shift click
outside the map div the co-ords are recalculated and displayed.  This should
not happen!  Further clicks outside the map do not trigger the handler.
http://demo.jdi-consult.net/oltest/custom-control-point.html

Can someone please confirm this, is there a quick fix?  Shall I add it to
JIRA?



On 9/1/07, Tom (JDi Solutions) <tom.dean at jdi-solutions.co.uk> wrote:
>
> I still can't work this one out, any help would be appreciated.  Here's a
> live example:
>
> http://demo.jdi-consult.net/oltest/clickprob.html
>
> When the map first loads you can click and hold to pan around.  Select
> "get Co-Ords" and you can no longer pan that way, instead a click on the map
> displays the co-ordinates below the map.  Now try to click on "navigate" in
> FF it will show the co-ordinates of the point you clicked, then on the
> second click it is possible to select "navigate".
>
> It works fine in IE6.
>
> Can anyone help?
>
> cheers,
>
> Tom
>
>
> On 8/31/07, Tom (JDi Solutions) < tom.dean at jdi-solutions.co.uk> wrote:
> >
> > Hi all,
> >
> > I've been creating a handler based on the code here:
> > http://trac.openlayers.org/wiki/Handlers
> >
> > What's supposed to happen is that the user clicks on the map and the
> > co-ordinates are sent off to a web service which returns a polygon in WKT
> > which is then plotted.  That all works fine except that after the user has
> > clicked the map once the next click anywhere in the map window will result
> > in a further call to the web service and no response from any other control
> > they may have clicked on, e.g. a link or button.  If the click was
> > outside the map div the user is then able to click on any other controls on
> > the page.  If the click was in the map window the behaviour continues.
> >
> > In the code below I can comment out everything in the sendpoint function
> > so that it does nothing but the behaviour still persists, i.e. the next
> > click will not activate anything else within the browser window.
> >
> > What's even more strange is that this actually works perfectly well in
> > IE6 and this behaviour is observed in Firefox only which tells me I'm doing
> > something very wrong.  Firebug is not reporting any errors.  I've not tried
> > IE7 or other browser as yet.
> >
> > Any ideas anyone?
> >
> > Here's some code:
> >
> >             drawControls = {
> >                 toidselect: new OpenLayers.Control()
> >             };
> >
> >             OpenLayers.Util.extend(drawControls['toidselect'], {
> >
> >                 draw: function () {
> >                     this.point = new OpenLayers.Handler.Point(
> > drawControls['toidselect'],
> >                         {"done": this.sendpoint})
> >                     this.point.activate();
> >                 },
> >
> >
> >                 sendpoint: function (point) {
> >                     var xpoint = point.lon;
> >                     var ypoint = point.lat;
> >                     if(!xpoint) {
> >                         xpoint = point.x;
> >                         ypoint = point.y;
> >                     }
> >
> >                     xmlhttp.open('get', 'polyselect.php?coords=' +
> > xpoint + ',' + ypoint, true);
> >                     xmlhttp.onreadystatechange = drawTOIDPolygon;
> >                     xmlhttp.send(null);
> >                 }
> >             });
> >
> >             for(var key in drawControls) {
> >                 map.addControl(drawControls[key]);
> >             }
> >
> > Thanks in advance,
> >
> > Tom Dean
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070904/8c20cc98/attachment.html


More information about the Users mailing list