[OpenLayers-Users] Mobile Support: Handling a tap like a mouse click...

Leonhard Dietze news at leole.de
Mon Jun 27 05:14:26 EDT 2011


Hi Steve,

I am currently also testing OpenLayers 2.11-rc1 on a mobile
device (ipad 2). Thank you for starting with this topic, it
showed me that I am not alone.

The click-Event in your first compass/mobile/ application works
perfect on the ipad2, but not the second (compass/mobile2/)
one.

I tried two approaches who do not work:
    var oClick = new OpenLayers.Control.Click();
    map.addControl(oClick);
    oClick.activate();

The second example that I got from searching does not
work either, but I thought that I had it running
once (and also I am not sure if this is not build too
complicated):

OpenLayers.Control.Click=OpenLayers.Class(OpenLayers.Control,{ 

    initialize: function(options) {			
       OpenLayers.Control.prototype.initialize.apply(this, arguments);
       this.handler = new OpenLayers.Handler.Click( this,
          { 'click': myClickHandler }, this.handlerOptions );
    }
});

Did you continue with your compass/mobile Examples? And find out
about the difference in the click-Events? All the other events
work perfectly: Zoom, Pan, Gestures and much better as with my
own Javascript-Handler that I tried to do.

Leonhard

Am 17.06.2011 17:06, schrieb Lime, Steve D (DNR):
> Chris: While using the handler approach works, behavior is different
> than registering the click event. I think it may have to do with the
> auto panning I do to center the map on a click but I have to dig into
> that. Using the click event didn't suffer the same issue. Is the
> click event registration not working on mobile devices (I tested with
> iPhone 4 and a Droid X) a bug? Here's a link to a version of my test
> app that uses event registration instead of a handler...
> http://maps1.dnr.state.mn.us/compass/mobile2/
>
> Steve


More information about the Users mailing list