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

Leonhard Dietze news at leole.de
Tue Jun 28 10:11:36 EDT 2011


Hi everybody,

in case somebody else stumbles over this message. After a lot
of OpenLayers/Javascript/Jquery-Debugging I finally found
the problem with my code (with JQuery,OpenLayers,JQuery-UI):
I was trying to stop the Click-Event from being further
evaluated. When I finally removed the line
    "Event.stop(oEvt);"
all the errors dissapeared.

This was the exception I received a lot of times in Firebug:
   uncaught exception: [Exception... "Illegal operation on WrappedNative
   prototype object" nsresult: "0x8057000c
   (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame ::
   http://localhost/js/OpenLayers-2.11rc.js :: anonymous :: line 252"
   data: no]

So everything now works fine with the source given in my last
mail as it was described by Chris Schmidt and Steve Lime.

And: Thank you very much Steve and Chris for your running examples,
it helped me a lot to know that it should/will actually run with
this setup on the iPAD.

Leonhard

Am 27.06.2011 11:14, schrieb Leonhard Dietze:
> 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