Skip to content

Commit

Permalink
fix(lint): lint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxue committed Aug 7, 2019
1 parent 462e00b commit 66c4304
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 116 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Expand Up @@ -44,6 +44,7 @@
"error",
"never"
],
"jsdoc/require-param": 0,
"linebreak-style": [
0
]
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -62,7 +62,7 @@
"shelljs": "~0.7.8",
"string-replace-loader": "~1.3.0",
"torchjs": "~2.1.0",
"uglify-js": "~3.1.10",
"uglify-js": "~3.1.10"
},
"scripts": {
"build-dev": "rollup -c --environment BUILD:dev",
Expand Down Expand Up @@ -130,7 +130,6 @@
"simple-statistics": "^7.0.1",
"supercluster": "^6.0.1",
"three": "^0.101.1",
"venn.js": "^0.2.20",
"viewport-mercator-project": "^5.2.0",
"webworkify-webpack": "^2.1.3",
"wolfy87-eventemitter": "~5.2.4"
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Expand Up @@ -14,8 +14,8 @@ const production = BUILD === 'production';
const outputFile = !production
? 'build/L7.js'
: minified
? 'build/L7-min.js'
: 'build/L7-unminified.js';
? 'build/L7-min.js'
: 'build/L7-unminified.js';

const config = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/attr/base.js
Expand Up @@ -156,7 +156,7 @@ class AttributeBase {

/**
* 映射数据
* @param {*} param1...paramn 多个数值
* @param {*} params 多个数值
* @return {Array} 映射的值组成的数组
*/
mapping(...params) {
Expand Down
2 changes: 1 addition & 1 deletion src/component/popup.js
Expand Up @@ -37,7 +37,7 @@ export default class Popup extends Base {
this._container.appendChild(this._content);
if (this.get('className')) {
this.get('className').split(' ').forEach(name =>
this._container.classList.add(name));
this._container.classList.add(name));
}
}
if (this.get('maxWidth') && this._container.style.maxWidth !== this.get('maxWidth')) {
Expand Down
13 changes: 7 additions & 6 deletions src/core/controller/mapping.js
Expand Up @@ -3,7 +3,7 @@ import Global from '../../global';
import ScaleController from './scale';
import Attr from '../../attr/index';
export default class Mapping {
/** 初始化mapping
/** 初始化mapping
* 初始化mapping
* @param {*} cfg 配置
* @param {*} cfg.layer layer对象
Expand All @@ -14,16 +14,19 @@ export default class Mapping {
if (!this.mesh) this.mesh = this.layer;
this._init();
}

_init() {
this._initControllers();
this._initTileAttrs();
this._mapping();
}

update() {
this.mesh.set('scales', {});
this._initTileAttrs();
this._updateMaping();
}

_initControllers() {
const scalesOption = this.layer.get('scaleOptions');
const scaleController = new ScaleController({
Expand All @@ -33,6 +36,7 @@ export default class Mapping {
});
this.mesh.set('scaleController', scaleController);
}

_createScale(field) {
const scales = this.mesh.get('scales');
this._initControllers(); // scale更新
Expand All @@ -43,6 +47,7 @@ export default class Mapping {
}
return scale;
}

createScale(field) {
const data = this.mesh.layerSource.data.dataArray;
const scales = this.mesh.get('scales');
Expand Down Expand Up @@ -72,6 +77,7 @@ export default class Mapping {
const values = attr.mapping(...params);
return values;
}

_mapping() {
const attrs = this.mesh.get('attrs');
const mappedData = [];
Expand Down Expand Up @@ -112,11 +118,6 @@ export default class Mapping {
this.mesh.layerData = mappedData;
}

/**
* 更新数据maping
* @param {*} layerSource 数据源
* @param {*} layer map
*/
_updateMaping() {
const attrs = this.mesh.get('attrs');

Expand Down
5 changes: 0 additions & 5 deletions src/core/controller/tile_mapping.js
Expand Up @@ -107,11 +107,6 @@ export default class TileMapping extends Base {
this.layerData = mappedData;
}

/**
* 更新数据maping
* @param {*} layerSource 数据源
* @param {*} layer map
*/
_updateMaping() {
const attrs = this.get('attrs');

Expand Down
2 changes: 1 addition & 1 deletion src/core/scene.js
Expand Up @@ -182,7 +182,7 @@ export default class Scene extends Base {
this.map.off('mapmove', this._updateRender);
this.map.off('camerachange', this._updateRender);
}
// control
// control

addControl(ctr) {
this.get('controlController').addControl(ctr);
Expand Down
53 changes: 0 additions & 53 deletions src/core/worker.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/geom/buffer/buffer.js
Expand Up @@ -112,7 +112,7 @@ export default class BufferBase extends Base {
prePoint[0], prePoint[1], 0,
nextPoint[0], nextPoint[1], 0
],
positionOffset * 3);
positionOffset * 3);
const indexArray = [ 1, 2, 0, 3, 2, 1 ].map(v => { return v + positionOffset; });
if (this.get('uv')) {
this.attributes.uv.set([ 0.1, 0, 0, 0, 0.1, size / 2000, 0, size / 2000 ], positionOffset * 2);
Expand Down
6 changes: 3 additions & 3 deletions src/geom/buffer/heatmap/grid_3d.js
Expand Up @@ -41,7 +41,7 @@ export default class Grid3D extends BufferBase {
this._encodeArray(feature, 4);
this.attributes.positions.set([ x, y, size, x, y, size, x, y, size, x, y, size ], this._offset * 3);
this.attributes.miters.set([ -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1 ], this._offset * 3);
this.attributes.normals.set([ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 ], this._offset * 3); // top normal
this.attributes.normals.set([ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 ], this._offset * 3); // top normal
const indexArray = [ 0, 2, 1, 2, 3, 1 ].map(v => { return v + this._offset; });
this.indexArray.set(indexArray, this._offset * 1.5);
this._offset += 4;
Expand All @@ -60,7 +60,7 @@ export default class Grid3D extends BufferBase {
-1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, // left
0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, // top
1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0 // right
], this._offset * 3); // top normal
], this._offset * 3); // top normal

for (let i = 0; i < 4; i++) {
this.attributes.positions.set([ x, y, 1, x, y, 1, x, y, 1, x, y, 1 ], this._offset * 3);
Expand All @@ -77,7 +77,7 @@ export default class Grid3D extends BufferBase {
prePoint[0], prePoint[1], 0,
nextPoint[0], nextPoint[1], 0
],
positionOffset * 3);
positionOffset * 3);
const indexArray = [ 0, 1, 2, 1, 3, 2 ].map(v => { return v + positionOffset; });
if (this.get('uv')) {
// temp 点亮城市demo
Expand Down
2 changes: 1 addition & 1 deletion src/geom/material/lineMaterial.js
Expand Up @@ -16,7 +16,7 @@ export function LineMaterial(options) {
vertexShader: vs,
fragmentShader: fs,
transparent: true
// blending: THREE.AdditiveBlending
// blending: THREE.AdditiveBlending
});
return material;
}
Expand Down
3 changes: 0 additions & 3 deletions src/geom/shape/point.js
Expand Up @@ -11,7 +11,6 @@ export function circle(type) {
}
/**
* @param {enum} type 渲染类型
* @param {boolean} extrude 是否进行高度拉伸
* @return {object} 顶点坐标和索引坐标
*/
export function triangle(type) {
Expand All @@ -21,7 +20,6 @@ export function triangle(type) {

/**
* @param {enum} type 渲染类型
* @param {boolean} extrude 是否进行高度拉伸
* @return {object} 顶点坐标和索引坐标
*/
export function diamond(type) {
Expand All @@ -35,7 +33,6 @@ export function square(type) {

/**
* @param {enum} type 渲染类型
* @param {boolean} extrude 是否进行高度拉伸
* @return {object} 顶点坐标和索引坐标
*/
export function hexagon(type) {
Expand Down
2 changes: 0 additions & 2 deletions src/geom/shape/polygon.js
Expand Up @@ -2,7 +2,6 @@ import extrudePolygon from '../extrude';
/**
* 计算平面的 polygon的顶点坐标和索引
* @param {Array} points 顶点坐标
* @param {*} extrude 是否拉伸
* @return {object} 顶点坐标和顶点索引
*/
export function fill(points) {
Expand All @@ -12,7 +11,6 @@ export function fill(points) {
/**
* 计算 extrude 的 polygon的顶点坐标和索引
* @param {Array} points 顶点坐标
* @param {*} extrude 是否拉伸
* @return {object} 顶点坐标和顶点索引
*/
export function extrude(points) {
Expand Down
2 changes: 1 addition & 1 deletion src/layer/tile/image_tile.js
Expand Up @@ -7,7 +7,7 @@ export default class ImageTile extends Tile {
// Making this asynchronous really speeds up the LOD framerate
setTimeout(() => {
if (!this._mesh) {
// this._mesh = this._createMesh();
// this._mesh = this._createMesh();
this._requestTile();
}
}, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/layer/tile/tile.js
Expand Up @@ -80,7 +80,7 @@ export default class Tile extends Base {
return urlParams[key];
});
}
// 经纬度范围转瓦片范围
// 经纬度范围转瓦片范围
_tileBounds(lnglatBound) {
const ne = this.layer.scene.project([ lnglatBound.getNorthEast().lng, lnglatBound.getNorthEast().lat ]);
const sw = this.layer.scene.project([ lnglatBound.getSouthWest().lng, lnglatBound.getSouthWest().lat ]);
Expand Down
4 changes: 2 additions & 2 deletions src/layer/tile/tile_layer.js
Expand Up @@ -116,7 +116,7 @@ export default class TileLayer extends Layer {
const tileRange = this._pxBoundsToTileRange(pixelBounds);
const margin = this.get('keepBuffer');
this.noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([ margin, -margin ]),
tileRange.getTopRight().add([ margin, -margin ]));
tileRange.getTopRight().add([ margin, -margin ]));
if (!(isFinite(tileRange.min.x) &&
isFinite(tileRange.min.y) &&
isFinite(tileRange.max.x) &&
Expand Down Expand Up @@ -424,7 +424,7 @@ export default class TileLayer extends Layer {
if (!this._tiles.children.length > 0 || !this._object3D.visible) {
return;
}
// 更新数据颜色 过滤 filter
// 更新数据颜色 过滤 filter
if (!Util.isEqual(preAttrs.color, nextAttrs.color) || !Util.isEqual(preAttrs.filter, nextAttrs.filter)) {
this._tileCache.setNeedUpdate();
this._tiles.children.forEach(tile => {
Expand Down
4 changes: 2 additions & 2 deletions src/layer/tile/vector_tile.js
Expand Up @@ -58,9 +58,9 @@ export default class VectorTile extends Tile {
context.depthMask(false);
renderer.clearDepth();

// only render where stencil is set to 1
// only render where stencil is set to 1

context.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1
context.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1
context.stencilOp(context.KEEP, context.KEEP, context.KEEP);
}
_tileMaskMesh() {
Expand Down
4 changes: 2 additions & 2 deletions src/layer/tile/vector_tile_mesh.js
Expand Up @@ -79,9 +79,9 @@ export default class VectorTileMesh {
context.depthMask(false);
renderer.clearDepth();

// only render where stencil is set to 1
// only render where stencil is set to 1

context.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1
context.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1
context.stencilOp(context.KEEP, context.KEEP, context.KEEP);
}
_tileMaskMesh() {
Expand Down
18 changes: 0 additions & 18 deletions src/scale/base.js
Expand Up @@ -64,23 +64,6 @@ class Base {

}

/**
* 获取该度量的ticks,返回的是多个对象,
* - text: tick 的文本
* - value: 对应的度量转换后的值
* <code>
* [
* {text: 0,value:0}
* {text: 1,value:0.2}
* {text: 2,value:0.4}
* {text: 3,value:0.6}
* {text: 4,value:0.8}
* {text: 5,value:1}
* ]
* </code>
* @param {Number} count 输出tick的个数的近似值,默认是 10
* @return {Array} 返回 ticks 数组
*/
getTicks() {
const self = this;
const ticks = self.ticks;
Expand Down Expand Up @@ -172,7 +155,6 @@ class Base {
/**
* 更改度量的属性信息
* @param {Object} info 属性信息
* @chainable
* @return {Scale} 返回自身的引用
*/
change(info) {
Expand Down
2 changes: 1 addition & 1 deletion src/source/parser/geojson.js
Expand Up @@ -3,7 +3,7 @@ import { getCoords } from '@turf/invariant';
import { djb2hash } from '../../util/bkdr-hash';
import rewind from '@mapbox/geojson-rewind';
export default function geoJSON(data, cfg) {
// 矢量瓦片图层不做 rewind
// 矢量瓦片图层不做 rewind

rewind(data, true);
const resultData = [];
Expand Down
4 changes: 2 additions & 2 deletions src/source/source_cache.js
Expand Up @@ -122,7 +122,7 @@ export default class SouceCache extends Base {
_calculateTileIDs() {
this._tileMap = {};
this.updateTileList = [];
const zoom = Math.floor(this.scene.getZoom()); // - window.window.devicePixelRatio + 1; // zoom - 1
const zoom = Math.floor(this.scene.getZoom()); // - window.window.devicePixelRatio + 1; // zoom - 1
const minSourceZoom = this.get('minZoom');
const maxSourceZoom = this.get('maxZoom');
this.tileZoom = zoom > maxSourceZoom ? maxSourceZoom : zoom;
Expand Down Expand Up @@ -300,7 +300,7 @@ export default class SouceCache extends Base {
}
}
}
// 地图拾取
// 地图拾取
_addPickMesh(layer, meshObj) {
if (this.type === 'image') {
return;
Expand Down

0 comments on commit 66c4304

Please sign in to comment.