Fix eslint errors

This commit is contained in:
Otto Pellinen
2019-09-13 13:11:19 +03:00
committed by Olivier Guyot
parent 00261dff54
commit 25a5e83910
2 changed files with 11 additions and 11 deletions
+8 -8
View File
@@ -2,11 +2,10 @@ import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import Draw from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import Snap from '../src/ol/interaction/Snap.js'; import Snap from '../src/ol/interaction/Snap.js';
import LineString from '../src/ol/geom/LineString'; import Style from '../src/ol/style/Style.js';
import Style from '../src/ol/style/Style'; import Stroke from '../src/ol/style/Stroke.js';
import Stroke from '../src/ol/style/Stroke';
import Collection from '../src/ol/Collection.js'; import Collection from '../src/ol/Collection.js';
import GeoJSON from '../src/ol/format/GeoJSON.js' import GeoJSON from '../src/ol/format/GeoJSON.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js'; import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js'; import {OSM, Vector as VectorSource} from '../src/ol/source.js';
@@ -22,7 +21,7 @@ sampleFeatures.push(
[-12000000, 4600000], [-12000000, 4600000],
[-12000000, 4000000], [-12000000, 4000000],
[-10000000, 5600000], [-10000000, 5600000],
[ -9000000, 3000000], [-9000000, 3000000],
[-10000000, 4000000], [-10000000, 4000000],
[-11000000, 3000000], [-11000000, 3000000],
[-13000000, 4000000], [-13000000, 4000000],
@@ -59,16 +58,18 @@ const map = new Map({
}) })
}); });
let draw; // global so we can remove it later
map.on('click', (event) => { map.on('click', (event) => {
let clickedFeature = null; let clickedFeature = null;
map.forEachFeatureAtPixel( map.forEachFeatureAtPixel(
event.pixel, event.pixel,
(feature, layer) => { (feature) => {
clickedFeature = feature; clickedFeature = feature;
}, { }, {
hitTolerance: 10, hitTolerance: 10,
layerFilter: (layer) => { layerFilter: (layer) => {
return layer === sampleVector return layer === sampleVector;
} }
} }
); );
@@ -86,7 +87,6 @@ const snapInteraction = new Snap({
const typeSelect = document.getElementById('type'); const typeSelect = document.getElementById('type');
let draw; // global so we can remove it later
function addInteraction() { function addInteraction() {
const value = typeSelect.value; const value = typeSelect.value;
if (value !== 'None') { if (value !== 'None') {
+3 -3
View File
@@ -911,9 +911,9 @@ class Draw extends PointerInteraction {
* @api * @api
*/ */
extend(feature) { extend(feature) {
const lineStringGeometry = feature.getGeometry();; const lineStringGeometry = feature.getGeometry();
const extendCoordinates = lineStringGeometry.getCoordinates(); const extendCoordinates = lineStringGeometry.getCoordinates();
const ending = extendCoordinates[extendCoordinates.length-1].slice(); const ending = extendCoordinates[extendCoordinates.length - 1].slice();
const mode = this.mode_; const mode = this.mode_;
let coordinates = []; let coordinates = [];
@@ -928,7 +928,7 @@ class Draw extends PointerInteraction {
// (1) Remove last coordinate, (2) extend coordinate list and (3) clone last coordinate // (1) Remove last coordinate, (2) extend coordinate list and (3) clone last coordinate
coordinates.pop(); coordinates.pop();
Array.prototype.push.apply(coordinates, extendCoordinates); Array.prototype.push.apply(coordinates, extendCoordinates);
coordinates.push(ending) coordinates.push(ending);
// Update geometry and sketch line // Update geometry and sketch line
this.geometryFunction_(this.sketchCoords_, this.sketchFeature_.getGeometry()); this.geometryFunction_(this.sketchCoords_, this.sketchFeature_.getGeometry());