diff --git a/src/core/layer.js b/src/core/layer.js index f8132f46b0..4a7e37b7db 100644 --- a/src/core/layer.js +++ b/src/core/layer.js @@ -419,9 +419,8 @@ export default class Layer extends Base { } } /** - * - * @param {*} overwrite - * @param {*} callback + * @param {*} type 类型 + * @param {*} callback 回调函数 */ on(type, callback) { @@ -448,7 +447,7 @@ export default class Layer extends Base { const pickmaterial = new PickingMaterial({ u_zoom: this.scene.getZoom() }); - + const pickingMesh = new THREE[mesh.type](mesh.geometry, pickmaterial); pickmaterial.setDefinesvalue(this.type, true); pickingMesh.onBeforeRender = () => { @@ -464,7 +463,7 @@ export default class Layer extends Base { // TODO: Find a way to properly remove this listener on destroy this.scene.on('pick', e => { // Re-emit click event from the layer - const { featureId, point2d, point3d, intersects } = e; + const { featureId, point2d, /* point3d, */intersects } = e; if (intersects.length === 0) { return; } const source = this.layerSource.get('data'); const feature = source.features[featureId]; @@ -493,7 +492,7 @@ export default class Layer extends Base { const colorAttr = this.layerMesh.geometry.attributes.a_color; const firstId = pickingId.indexOf(featureStyleId[0] + 1); for (let i = firstId; i < pickingId.length; i++) { - if (pickingId[i] == featureStyleId[0] + 1) { + if (pickingId[i] === featureStyleId[0] + 1) { colorAttr.array[i * 4 + 0] = color[0]; colorAttr.array[i * 4 + 1] = color[1]; colorAttr.array[i * 4 + 2] = color[2]; @@ -556,7 +555,7 @@ export default class Layer extends Base { } else if (this.type === 'polyline') { offset = 2; } - this._object3D.position.z = offset * Math.pow(2, 20 - zoom); + this._object3D.position.z = offset * Math.pow(2, 20 - zoom); if (zoom < minZoom || zoom > maxZoom) { this._object3D.visible = false; } else if (this.get('visible')) { @@ -569,11 +568,11 @@ export default class Layer extends Base { resetStyle() { const pickingId = this.layerMesh.geometry.attributes.pickingId.array; const colorAttr = this.layerMesh.geometry.attributes.a_color; - this._activeIds.forEach((index, value) => { + this._activeIds.forEach(index => { const color = this.StyleData[index].color; const firstId = pickingId.indexOf(index + 1); for (let i = firstId; i < pickingId.length; i++) { - if (pickingId[i] == index + 1) { + if (pickingId[i] === index + 1) { colorAttr.array[i * 4 + 0] = color[0]; colorAttr.array[i * 4 + 1] = color[1]; colorAttr.array[i * 4 + 2] = color[2]; diff --git a/src/core/scene.js b/src/core/scene.js index 52e9d90ed1..36b1a65430 100644 --- a/src/core/scene.js +++ b/src/core/scene.js @@ -33,9 +33,10 @@ export default class Scene extends Base { Map.on('mapLoad', () => { this._initEngine(Map.renderDom); const sceneMap = new GaodeMap(Map.map); - // eslint-disable-next-line - Object.getOwnPropertyNames(sceneMap.__proto__).forEach((key)=>{ - if ('key' !== 'constructor') { this.__proto__[key] = sceneMap.__proto__[key]; } + Object.getOwnPropertyNames(sceneMap.prototype).forEach(key => { + if (key !== 'constructor') { + this.prototype[key] = sceneMap.prototype[key]; + } }); this.map = Map.map; Map.asyncCamera(this._engine); diff --git a/src/geom/buffer/point.js b/src/geom/buffer/point.js index bb928c86af..833b101a2c 100644 --- a/src/geom/buffer/point.js +++ b/src/geom/buffer/point.js @@ -1,7 +1,7 @@ import BufferBase from './bufferBase'; import { regularShape } from '../shape/index'; import Util from '../../util'; -import * as THREE from '../../core/three'; +// import * as THREE from '../../core/three'; export default class PointBuffer extends BufferBase { geometryBuffer() { const type = this.get('type'); diff --git a/src/layer/pointLayer.js b/src/layer/pointLayer.js index 1ba952e088..fa9c1bc7bb 100644 --- a/src/layer/pointLayer.js +++ b/src/layer/pointLayer.js @@ -7,7 +7,7 @@ import TextBuffer from '../geom/buffer/text'; import TextMaterial from '../geom/material/textMaterial'; import radar from '../geom/shader/radar_frag.glsl'; import warn from '../geom/shader/warn_frag.glsl'; -import pickingMaterial from '../core/engine/picking/pickingMaterial'; +// import pickingMaterial from '../core/engine/picking/pickingMaterial'; /** * point shape 2d circle, traingle text,image @@ -58,7 +58,7 @@ export default class PointLayer extends Layer { // u_zoom: this.scene.getZoom() // }) // mtl.setDefinesvalue('point', true); - mtl.setDefinesvalue('SHAPE', true); + mtl.setDefinesvalue('SHAPE', true); if (shape === 'radar') { mtl.fragmentShader = radar; diff --git a/src/source/csvSource.js b/src/source/csvSource.js index 294407cc53..89dc55b1cc 100644 --- a/src/source/csvSource.js +++ b/src/source/csvSource.js @@ -21,8 +21,7 @@ export default class CSVSource extends Source { if (col.coordinates) { coordinates = col.coordinates; } - if(x && y) - coordinates = [ col[x], col[y] ]; + if (x && y) { coordinates = [ col[x], col[y] ]; } if (x1 && y1) { coordinates = [[ col[x], col[y] ], [ col[x1], col[y1] ]]; } diff --git a/src/source/geojsonSource.js b/src/source/geojsonSource.js index 0a611e8da9..f12872c4c2 100644 --- a/src/source/geojsonSource.js +++ b/src/source/geojsonSource.js @@ -25,19 +25,17 @@ export default class GeojsonSource extends Source { const data = this.get('data'); const selectFeatureIds = []; let featureStyleId = 0; - /* eslint-disable */ - turfMeta.flattenEach(data, (currentFeature, featureIndex, multiFeatureIndex) => { - /* eslint-disable */ - if (featureIndex === (featureId)) { - selectFeatureIds.push(featureStyleId); - } - featureStyleId++; - if (featureIndex > featureId) { - return; - } - }); + turfMeta.flattenEach(data, (currentFeature, featureIndex/* , multiFeatureIndex*/) => { + if (featureIndex === (featureId)) { + selectFeatureIds.push(featureStyleId); + } + featureStyleId++; + if (featureIndex > featureId) { + return; + } + }); return selectFeatureIds; - + } } diff --git a/src/worker/main.worker.js b/src/worker/main.worker.js index 61f73c16d5..eb53453282 100644 --- a/src/worker/main.worker.js +++ b/src/worker/main.worker.js @@ -30,6 +30,5 @@ self.addEventListener('message', e => { } }); self.addEventListener('error', function(e) { - /* eslint-disable */ - console.log('filename:' + e.filename + '\nmessage:' + e.message + '\nline:' + e.lineno); + console.error('filename:' + e.filename + '\nmessage:' + e.message + '\nline:' + e.lineno); });