我有一个矢量图层,用于在地图上将标记显示为特征,但现在,我所做的,它们是可拖动或可点击的。我该怎么做才能两者兼得?
/*** Init Drag Marker
*/
var dragFeature = new OpenLayers.Control.DragFeature(layerTrackMarker,
{'onComplete': updateMarker}
);
map.addControl(dragFeature);
dragFeature.activate();
/*** Init Click Marker
*/
var clickFeature = new OpenLayers.Control.SelectFeature(layerTrackMarker,
{}
);
map.addControl(clickFeature);
layerTrackMarker.events.on({
"featureselected": function(e) {
var markerId = e.feature.geometry.id;
removeMarker(markerId);
/* ToDo: show context menu */
},
"featureunselected": function(e) {
/* ToDo: hide context menu */
}
});
clickFeature.activate();