[OpenLayers-Users] Handler problems

Tom (JDi Solutions) tom.dean at jdi-solutions.co.uk
Sat Sep 1 05:47:22 EDT 2007


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/20070901/15555886/attachment.html


More information about the Users mailing list