Use blocked scoped variables
In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
@@ -6,21 +6,21 @@ import VectorLayer from '../src/ol/layer/Vector.js';
|
||||
import BingMaps from '../src/ol/source/BingMaps.js';
|
||||
import VectorSource from '../src/ol/source/Vector.js';
|
||||
|
||||
var raster = new TileLayer({
|
||||
const raster = new TileLayer({
|
||||
source: new BingMaps({
|
||||
imagerySet: 'Aerial',
|
||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
|
||||
})
|
||||
});
|
||||
|
||||
var vector = new VectorLayer({
|
||||
const vector = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
url: 'data/kml/2012-02-10.kml',
|
||||
format: new KML()
|
||||
})
|
||||
});
|
||||
|
||||
var map = new Map({
|
||||
const map = new Map({
|
||||
layers: [raster, vector],
|
||||
target: document.getElementById('map'),
|
||||
view: new View({
|
||||
@@ -30,14 +30,14 @@ var map = new Map({
|
||||
})
|
||||
});
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
const displayFeatureInfo = function(pixel) {
|
||||
const features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
var info = [];
|
||||
var i, ii;
|
||||
const info = [];
|
||||
let i, ii;
|
||||
for (i = 0, ii = features.length; i < ii; ++i) {
|
||||
info.push(features[i].get('name'));
|
||||
}
|
||||
@@ -53,7 +53,7 @@ map.on('pointermove', function(evt) {
|
||||
if (evt.dragging) {
|
||||
return;
|
||||
}
|
||||
var pixel = map.getEventPixel(evt.originalEvent);
|
||||
const pixel = map.getEventPixel(evt.originalEvent);
|
||||
displayFeatureInfo(pixel);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user