I was going to suggest using the dojo gesture library, grabbing the screen coordinates,converting them using esri/geometry/screenUtils, but it appears that dojox/gesture/tap does not contain the pageX or pageY details in the returned event. open ticket.
If this did work, you could capture the double tap like this fiddle.
Using Hammer.js I got very close in this fiddle.
Relevant code to capture the double tap event.
var hammertime = Hammer(dom.byId("mapDiv"));
hammertime.on("doubletap", function (e) {
// convert screen coords to map coords
var x, y, point, mapPoint, sms, graphic;
x = e.gesture.center.pageX;
y = e.gesture.center.pageY;
point = new Point(x, y);
mapPoint = screenUtils.toMapPoint(
map.extent,
map.width,
map.height,
point
);
sms = new SimpleMarkerSymbol().setStyle(
SimpleMarkerSymbol.STYLE_SQUARE)
.setColor(new Color([255, 0, 0, 0.5])
);
graphic = new Graphic(mapPoint, sms);
map.graphics.add(graphic);
});
There is a slight offset of where the graphic is placed versus where the map was actually double-tapped, but I think this has to do with the frames. You may have some luck going down this route and doing some additional math for margins/padding if required. The Hammer gestures may work better for you on mobile than the Dojo ones will,
Hope that helps.
ah ok dblclick
is the answer
// set mode to current mode of double clicked feature
map.on('dblclick', function(evt) {
console.log('doubled');
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
// do stuff here
});
});
and evt.originalEvent.altKey
, evt.originalEvent.ctrlKey
, evt.originalEvent.metaKey
, evt.originalEvent.shitKey
are all availabe within the handler!
Best Answer
I found the solution by myself for long tap: