Vector examples display feature info on click again

This commit is contained in:
Éric Lemoine
2013-10-17 15:16:50 +02:00
parent 4c7f30c139
commit 4008ab7f6c
5 changed files with 55 additions and 15 deletions

View File

@@ -82,9 +82,7 @@ info.tooltip({
trigger: 'manual'
});
// FIXME support touch devices
$(map.getViewport()).on('mousemove', function(evt) {
var pixel = map.getEventPixel(evt.originalEvent);
var displayFeatureInfo = function(pixel) {
info.css({
left: pixel[0] + 'px',
top: (pixel[1] - 15) + 'px'
@@ -104,4 +102,14 @@ $(map.getViewport()).on('mousemove', function(evt) {
}
}
});
};
$(map.getViewport()).on('mousemove', function(evt) {
var pixel = map.getEventPixel(evt.originalEvent);
displayFeatureInfo(pixel);
});
map.on('click', function(evt) {
var pixel = evt.getPixel();
displayFeatureInfo(pixel);
});