我正在将 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));
});
谢谢你 :)