Merge branch 'chore-codeLinting' into 'master'

chore(dev): fixing code style to pass linting



See merge request !2
This commit is contained in:
象数 2018-11-20 17:52:02 +08:00
commit f15ce44702
7 changed files with 27 additions and 31 deletions

View File

@ -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];

View File

@ -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);

View File

@ -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');

View File

@ -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;

View File

@ -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] ]];
}

View File

@ -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;
}
}

View File

@ -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);
});