JavaScript API on mobile device

1392
3
08-28-2014 06:18 AM
KyleDixon
Occasional Contributor

I'm working on optimizing an existing application for mobile devices (iPad, Tablet, Note) and trying to work out how the events are triggered.

The desktop app has hover and click events, on the mobile devices a tap triggers the hover event, how do I trigger the click event?

0 Kudos
3 Replies
TimWitt2
MVP Alum

Kyle,

shouldn't it work just like using it on desktop?

i.e. map.on("click", dosomething);

here is an example: Simple map for iOS | ArcGIS API for JavaScript

Tim

0 Kudos
KyleDixon
Occasional Contributor

You would think so...

I have different graphics layers, one layer has the hover, when hovered details are displayed in a table and the graphic is added to another layer which is registered to the click event. It works perfectly in all desktop browsers.

looks like this:

graphicLayer1.on("hover", function(evt){

    graphicLayer2.add(evt.graphic);

    graphicLayer2.on("click", function(evt){

       doSomething(); // Never fires on a mobile device

    }

}

I may need to rework the flow, this was originally written with api 1.6.

0 Kudos
ReneRubalcava
Frequent Contributor

Well, 'click' will work, dbl-click/dbl tap not so much. There's a thread discussing some click/tap issues here that are stil present in the current issue of the api. There's a hacky way to do it, but so far it's an "all hack" or nothing solution as it will break some other click events.

Feature Layer double TAP point

0 Kudos