我正在为移动应用程序使用sencha touch和openlayers! 当我用android触摸地图时,我想添加一个标记,如“onLongPress”! 我搜索的是类似的代码,但是谁支持触摸屏。
map.events.register("click", map, function(e) {
//var position = this.events.getMousePosition(e);
var position = map.getLonLatFromPixel(e.xy);
var size = new OpenLayers.Size(21,25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon('images/mark.png', size, offset);
var markerslayer = map.getLayer('Markers');
markerslayer.addMarker(new OpenLayers.Marker(position,icon));
});
谢谢你:)