mirror of https://gitee.com/antv-l7/antv-l7
Merge branch 'chore-codeLinting' into 'master'
chore(dev): fixing code style to pass linting See merge request !2
This commit is contained in:
commit
f15ce44702
|
@ -419,9 +419,8 @@ export default class Layer extends Base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* @param {*} type 类型
|
||||||
* @param {*} overwrite
|
* @param {*} callback 回调函数
|
||||||
* @param {*} callback
|
|
||||||
*/
|
*/
|
||||||
on(type, callback) {
|
on(type, callback) {
|
||||||
|
|
||||||
|
@ -448,7 +447,7 @@ export default class Layer extends Base {
|
||||||
const pickmaterial = new PickingMaterial({
|
const pickmaterial = new PickingMaterial({
|
||||||
u_zoom: this.scene.getZoom()
|
u_zoom: this.scene.getZoom()
|
||||||
});
|
});
|
||||||
|
|
||||||
const pickingMesh = new THREE[mesh.type](mesh.geometry, pickmaterial);
|
const pickingMesh = new THREE[mesh.type](mesh.geometry, pickmaterial);
|
||||||
pickmaterial.setDefinesvalue(this.type, true);
|
pickmaterial.setDefinesvalue(this.type, true);
|
||||||
pickingMesh.onBeforeRender = () => {
|
pickingMesh.onBeforeRender = () => {
|
||||||
|
@ -464,7 +463,7 @@ export default class Layer extends Base {
|
||||||
// TODO: Find a way to properly remove this listener on destroy
|
// TODO: Find a way to properly remove this listener on destroy
|
||||||
this.scene.on('pick', e => {
|
this.scene.on('pick', e => {
|
||||||
// Re-emit click event from the layer
|
// Re-emit click event from the layer
|
||||||
const { featureId, point2d, point3d, intersects } = e;
|
const { featureId, point2d, /* point3d, */intersects } = e;
|
||||||
if (intersects.length === 0) { return; }
|
if (intersects.length === 0) { return; }
|
||||||
const source = this.layerSource.get('data');
|
const source = this.layerSource.get('data');
|
||||||
const feature = source.features[featureId];
|
const feature = source.features[featureId];
|
||||||
|
@ -493,7 +492,7 @@ export default class Layer extends Base {
|
||||||
const colorAttr = this.layerMesh.geometry.attributes.a_color;
|
const colorAttr = this.layerMesh.geometry.attributes.a_color;
|
||||||
const firstId = pickingId.indexOf(featureStyleId[0] + 1);
|
const firstId = pickingId.indexOf(featureStyleId[0] + 1);
|
||||||
for (let i = firstId; i < pickingId.length; i++) {
|
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 + 0] = color[0];
|
||||||
colorAttr.array[i * 4 + 1] = color[1];
|
colorAttr.array[i * 4 + 1] = color[1];
|
||||||
colorAttr.array[i * 4 + 2] = color[2];
|
colorAttr.array[i * 4 + 2] = color[2];
|
||||||
|
@ -556,7 +555,7 @@ export default class Layer extends Base {
|
||||||
} else if (this.type === 'polyline') {
|
} else if (this.type === 'polyline') {
|
||||||
offset = 2;
|
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) {
|
if (zoom < minZoom || zoom > maxZoom) {
|
||||||
this._object3D.visible = false;
|
this._object3D.visible = false;
|
||||||
} else if (this.get('visible')) {
|
} else if (this.get('visible')) {
|
||||||
|
@ -569,11 +568,11 @@ export default class Layer extends Base {
|
||||||
resetStyle() {
|
resetStyle() {
|
||||||
const pickingId = this.layerMesh.geometry.attributes.pickingId.array;
|
const pickingId = this.layerMesh.geometry.attributes.pickingId.array;
|
||||||
const colorAttr = this.layerMesh.geometry.attributes.a_color;
|
const colorAttr = this.layerMesh.geometry.attributes.a_color;
|
||||||
this._activeIds.forEach((index, value) => {
|
this._activeIds.forEach(index => {
|
||||||
const color = this.StyleData[index].color;
|
const color = this.StyleData[index].color;
|
||||||
const firstId = pickingId.indexOf(index + 1);
|
const firstId = pickingId.indexOf(index + 1);
|
||||||
for (let i = firstId; i < pickingId.length; i++) {
|
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 + 0] = color[0];
|
||||||
colorAttr.array[i * 4 + 1] = color[1];
|
colorAttr.array[i * 4 + 1] = color[1];
|
||||||
colorAttr.array[i * 4 + 2] = color[2];
|
colorAttr.array[i * 4 + 2] = color[2];
|
||||||
|
|
|
@ -33,9 +33,10 @@ export default class Scene extends Base {
|
||||||
Map.on('mapLoad', () => {
|
Map.on('mapLoad', () => {
|
||||||
this._initEngine(Map.renderDom);
|
this._initEngine(Map.renderDom);
|
||||||
const sceneMap = new GaodeMap(Map.map);
|
const sceneMap = new GaodeMap(Map.map);
|
||||||
// eslint-disable-next-line
|
Object.getOwnPropertyNames(sceneMap.prototype).forEach(key => {
|
||||||
Object.getOwnPropertyNames(sceneMap.__proto__).forEach((key)=>{
|
if (key !== 'constructor') {
|
||||||
if ('key' !== 'constructor') { this.__proto__[key] = sceneMap.__proto__[key]; }
|
this.prototype[key] = sceneMap.prototype[key];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.map = Map.map;
|
this.map = Map.map;
|
||||||
Map.asyncCamera(this._engine);
|
Map.asyncCamera(this._engine);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import BufferBase from './bufferBase';
|
import BufferBase from './bufferBase';
|
||||||
import { regularShape } from '../shape/index';
|
import { regularShape } from '../shape/index';
|
||||||
import Util from '../../util';
|
import Util from '../../util';
|
||||||
import * as THREE from '../../core/three';
|
// import * as THREE from '../../core/three';
|
||||||
export default class PointBuffer extends BufferBase {
|
export default class PointBuffer extends BufferBase {
|
||||||
geometryBuffer() {
|
geometryBuffer() {
|
||||||
const type = this.get('type');
|
const type = this.get('type');
|
||||||
|
|
|
@ -7,7 +7,7 @@ import TextBuffer from '../geom/buffer/text';
|
||||||
import TextMaterial from '../geom/material/textMaterial';
|
import TextMaterial from '../geom/material/textMaterial';
|
||||||
import radar from '../geom/shader/radar_frag.glsl';
|
import radar from '../geom/shader/radar_frag.glsl';
|
||||||
import warn from '../geom/shader/warn_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
|
* point shape 2d circle, traingle text,image
|
||||||
|
@ -58,7 +58,7 @@ export default class PointLayer extends Layer {
|
||||||
// u_zoom: this.scene.getZoom()
|
// u_zoom: this.scene.getZoom()
|
||||||
// })
|
// })
|
||||||
// mtl.setDefinesvalue('point', true);
|
// mtl.setDefinesvalue('point', true);
|
||||||
mtl.setDefinesvalue('SHAPE', true);
|
mtl.setDefinesvalue('SHAPE', true);
|
||||||
if (shape === 'radar') {
|
if (shape === 'radar') {
|
||||||
mtl.fragmentShader = radar;
|
mtl.fragmentShader = radar;
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@ export default class CSVSource extends Source {
|
||||||
if (col.coordinates) {
|
if (col.coordinates) {
|
||||||
coordinates = col.coordinates;
|
coordinates = col.coordinates;
|
||||||
}
|
}
|
||||||
if(x && y)
|
if (x && y) { coordinates = [ col[x], col[y] ]; }
|
||||||
coordinates = [ col[x], col[y] ];
|
|
||||||
if (x1 && y1) {
|
if (x1 && y1) {
|
||||||
coordinates = [[ col[x], col[y] ], [ col[x1], col[y1] ]];
|
coordinates = [[ col[x], col[y] ], [ col[x1], col[y1] ]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,19 +25,17 @@ export default class GeojsonSource extends Source {
|
||||||
const data = this.get('data');
|
const data = this.get('data');
|
||||||
const selectFeatureIds = [];
|
const selectFeatureIds = [];
|
||||||
let featureStyleId = 0;
|
let featureStyleId = 0;
|
||||||
/* eslint-disable */
|
turfMeta.flattenEach(data, (currentFeature, featureIndex/* , multiFeatureIndex*/) => {
|
||||||
turfMeta.flattenEach(data, (currentFeature, featureIndex, multiFeatureIndex) => {
|
if (featureIndex === (featureId)) {
|
||||||
/* eslint-disable */
|
selectFeatureIds.push(featureStyleId);
|
||||||
if (featureIndex === (featureId)) {
|
}
|
||||||
selectFeatureIds.push(featureStyleId);
|
featureStyleId++;
|
||||||
}
|
if (featureIndex > featureId) {
|
||||||
featureStyleId++;
|
return;
|
||||||
if (featureIndex > featureId) {
|
}
|
||||||
return;
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
return selectFeatureIds;
|
return selectFeatureIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,5 @@ self.addEventListener('message', e => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.addEventListener('error', function(e) {
|
self.addEventListener('error', function(e) {
|
||||||
/* eslint-disable */
|
console.error('filename:' + e.filename + '\nmessage:' + e.message + '\nline:' + e.lineno);
|
||||||
console.log('filename:' + e.filename + '\nmessage:' + e.message + '\nline:' + e.lineno);
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue