Fix and improve xray viewer
This commit is contained in:
parent
1307b29ff9
commit
d57f9f7a60
1 changed files with 12 additions and 6 deletions
|
@ -103,12 +103,18 @@
|
||||||
var propertyList = document.getElementById('propertyList');
|
var propertyList = document.getElementById('propertyList');
|
||||||
map.on('mousemove', function(e) {
|
map.on('mousemove', function(e) {
|
||||||
propertyList.innerHTML = '';
|
propertyList.innerHTML = '';
|
||||||
map.featuresAt(e.point, {radius: 3}, function(err, features) {
|
var width = 3, height = 3;
|
||||||
if (err) throw err;
|
var features = map.queryRenderedFeatures([
|
||||||
if (features[0]) {
|
[e.point.x - width / 2, e.point.y - height / 2],
|
||||||
propertyList.innerHTML = JSON.stringify(features[0].properties, null, 2);
|
[e.point.x + width / 2, e.point.y + height / 2]
|
||||||
}
|
]);
|
||||||
});
|
if (features) {
|
||||||
|
var html = '';
|
||||||
|
features.forEach(function(feature) {
|
||||||
|
html += JSON.stringify(feature.properties, null, 2) + '\n';
|
||||||
|
});
|
||||||
|
propertyList.innerHTML = html;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{{/is_vector}}
|
{{/is_vector}}
|
||||||
|
|
Loading…
Reference in a new issue