Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
fix lint
Shan He78b7146dd5df
diff --git a/.eslintrc b/.eslintrcindex 5baa02e34..8ca561a7b 100644--- a/.eslintrc+++ b/.eslintrc@@ -6,6 +6,10 @@"prettier","prettier/react"],++ "env": {+ "es6": true+ },"parser": "babel-eslint","plugins": ["babel",diff --git a/examples/demo-app/src/actions.js b/examples/demo-app/src/actions.jsindex 86eb2c793..a4b22101b 100644--- a/examples/demo-app/src/actions.js+++ b/examples/demo-app/src/actions.js@@ -20,11 +20,9 @@import {push} from 'react-router-redux';import {text as requestText, json as requestJson} from 'd3-request';-import {toggleModal} from 'kepler.gl/actions';-+import {console as Console} from 'global/window';import {MAP_CONFIG_URL} from './constants/sample-maps';-// import {getAppUrlPrefix} from './constants/default-settings';// CONSTANTSexport const INIT = 'INIT';@@ -58,8 +56,6 @@ export function laodMapSampleFile(samples) {export function loadSampleMap(sample) {return (dispatch) => {- // const prefix = getAppUrlPrefix();- // const appendPrefix = prefix !== '' ? `/${getAppUrlPrefix()}/` : '/';dispatch(push(`/demo/${sample.id}`));dispatch(loadRemoteMap(sample));dispatch(toggleModal(null));@@ -70,13 +66,13 @@ function loadRemoteMap(sample) {return (dispatch) => {requestJson(sample.configUrl, (confError, config) => {if (confError) {- console.warn(`Error loading config file ${sample.configUrl}`);+ Console.warn(`Error loading config file ${sample.configUrl}`);// dispatch(error)return;}requestText(sample.dataUrl, (dataError, result) => {if (dataError) {- console.warn(`Error loading datafile ${sample.dataUrl}`);+ Console.warn(`Error loading datafile ${sample.dataUrl}`);// dispatch(ERROR)} else {dispatch(loadResponseFromRemoteFile(result, config, sample));@@ -96,8 +92,7 @@ export function loadSampleConfigurations(sampleMapId = null) {return (dispatch) => {requestJson(MAP_CONFIG_URL, (error, samples) => {if (error) {- console.warn(`Error loading sample configuration file ${MAP_CONFIG_URL}`);- // dispatch(ERROR)+ Console.warn(`Error loading sample configuration file ${MAP_CONFIG_URL}`);} else {dispatch(laodMapSampleFile(samples));// Load the specified mapdiff --git a/examples/demo-app/src/app.js b/examples/demo-app/src/app.jsindex 5736409aa..d030b1f59 100644--- a/examples/demo-app/src/app.js+++ b/examples/demo-app/src/app.js@@ -21,8 +21,6 @@import React, {Component} from 'react';import {connect} from 'react-redux';import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';-import Processor from 'kepler.gl/processors';-import {updateVisData, addDataToMap} from 'kepler.gl/actions';import {loadSampleConfigurations} from './actions';import {replaceLoadDataModal} from './factories/load-data-modal';@@ -33,43 +31,11 @@ const KeplerGl = require('kepler.gl/components').injectComponents([const MAPBOX_TOKEN = process.env.MapboxAccessToken; // eslint-disable-line-/*- define custom header- inject custom component factory to replace default one--import {withState} from 'kepler.gl/components';-import {visStateLens} from 'kepler.gl/reducers';-import {wrapTo} from 'kepler.gl/actions';--// custom action wrap to mounted instance-const addTodoAction = (text) => wrapTo('map', {- type: 'ADD_TODO',- text-});--const CustomHeader = ({visState, addTodo}) => (- <div onClick={() => addTodo('hello')}>{`${Object.keys(visState.datasets).length} dataset loaded`}</div>-);--const headerStateToProps = state => ({loaded: state.app.loaded});-const myCustomHeaderFactory = () => withState(- // keplerGl state lenses- [visStateLens],- // customMapStateToProps- headerStateToProps,- // actions- {addTodo: addTodoAction}-)(CustomHeader);--const KeplerGl = injectComponents([- [PanelHeaderFactory, myCustomHeaderFactory]-]);- */-// Sample data/* eslint-disable no-unused-vars */import sampleTripData from './data/sample-trip-data';import sampleGeojson from './data/sample-geojson.json';+import {updateVisData, addDataToMap} from 'kepler.gl/actions';/* eslint-enable no-unused-vars */class App extends Component {diff --git a/examples/demo-app/src/components/load-data-modal/load-data-modal.js b/examples/demo-app/src/components/load-data-modal/load-data-modal.jsindex 75854c79b..d0b65dd04 100644--- a/examples/demo-app/src/components/load-data-modal/load-data-modal.js+++ b/examples/demo-app/src/components/load-data-modal/load-data-modal.js@@ -21,7 +21,7 @@import React, {Component} from 'react';import classnames from 'classnames';import styled, {ThemeProvider} from 'styled-components';-import {FileUpload, ModalFooter} from 'kepler.gl/components';+import {FileUpload} from 'kepler.gl/components';import {themeLT} from 'kepler.gl/styles';import {Icons} from 'kepler.gl/components/';diff --git a/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js b/examples/demo-app/src/components/load-data-modal/sample-data-viewer.jsindex bed9f921b..7371d6b18 100644--- a/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js+++ b/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js@@ -21,10 +21,7 @@import React from 'react';import PropTypes from 'prop-types';import styled from 'styled-components';-import {SAMPLE_MAPS} from '../../constants/sample-maps';-// TODO: change this one-// import {LeftArrow} from '@uber/react-inline-icons';-import {Icons} from 'kepler.gl/components/';+import {Icons} from 'kepler.gl/components';import {format} from 'd3-format';const numFormat = format(',');@@ -129,7 +126,7 @@ const SampleMap = ({sample, onClick}) => (const SampleMapGallery = ({sampleData, sampleMaps, onLoadSampleData, back}) => (<div className="sample-data-modal"><BackLink onClick={back}>- <Icons.ArrowLeft height="12px" />+ <Icons.LeftArrow height="12px" /><span>Back</span></BackLink><StyledSampleGallery className="sample-map-gallery">diff --git a/examples/demo-app/src/reducers.js b/examples/demo-app/src/reducers.jsindex 51b7d92f0..9de3dd276 100644--- a/examples/demo-app/src/reducers.js+++ b/examples/demo-app/src/reducers.js@@ -18,7 +18,6 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {routerReducer} from 'react-router-redux';import {combineReducers} from 'redux';import {handleActions} from 'redux-actions';@@ -26,8 +25,6 @@ import keplerGlReducer, {combineUpdaters} from 'kepler.gl/reducers';import Processor from 'kepler.gl/processors';import KeplerGlSchema from 'kepler.gl/schemas';-// import {LOAD_REMOTE_FILE_DATA_SUCCESS} from './actions';-import {INIT,SET_LOADING_METHOD,@@ -69,7 +66,7 @@ export const appReducer = handleActions({const demoReducer = combineReducers({// mount keplerGl reducerkeplerGl: keplerGlReducer,- app: appReducer,+ app: appReducer});// this can be moved into a action and call kepler.gl actiondiff --git a/src/components/common/icons/index.js b/src/components/common/icons/index.jsindex a4eed46fe..71fcd3ef7 100644--- a/src/components/common/icons/index.js+++ b/src/components/common/icons/index.js@@ -39,6 +39,7 @@ export {default as FileType} from './file-type';export {default as FilterFunnel} from './filter-funnel';export {default as Histogram} from './histogram';export {default as Layers} from './layers';+export {default as LeftArrow} from './left-arrow';export {default as Legend} from './legend';export {default as LineChart} from './line-chart';export {default as Minus} from './minus';diff --git a/src/components/common/icons/left-arrow.js b/src/components/common/icons/left-arrow.jsnew file mode 100644index 000000000..c68a94fa4--- /dev/null+++ b/src/components/common/icons/left-arrow.js@@ -0,0 +1,27 @@+import PropTypes from 'prop-types';+import React from 'react';+import Base from './base';++class LeftArrow extends React.Component {+ static displayName = 'LeftArrow';++ static propTypes = {+ /** Set the height of the icon, ex. '16px' */+ height: PropTypes.string+ };++ static defaultProps = {+ height: '16px',+ predefinedClassName: 'data-ex-icons-left-arrow'+ };++ render() {+ return (+ <Base viewBox="0 0 64 64" {...this.props}>+ <path d="M39.425 53.21L23.16 36.947l-4.242-4.243a1 1 0 0 1 0-1.414l4.242-4.243 16.264-16.263a1 1 0 0 1 1.414 0l4.242 4.242a1 1 0 0 1 0 1.414L29.525 31.997l15.556 15.556a1 1 0 0 1 0 1.414L40.84 53.21a1 1 0 0 1-1.414 0z"/>+ </Base>+ );+ }+}++export default LeftArrow;diff --git a/src/deckgl-layers/building-layer/building-layer-fragment.glsl.js b/src/deckgl-layers/building-layer/building-layer-fragment.glsl.jsdeleted file mode 100644index 3b8cf10a6..000000000--- a/src/deckgl-layers/building-layer/building-layer-fragment.glsl.js+++ /dev/null@@ -1,33 +0,0 @@-// Copyright (c) 2018 Uber Technologies, Inc.-//-// Permission is hereby granted, free of charge, to any person obtaining a copy-// of this software and associated documentation files (the "Software"), to deal-// in the Software without restriction, including without limitation the rights-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-// copies of the Software, and to permit persons to whom the Software is-// furnished to do so, subject to the following conditions:-//-// The above copyright notice and this permission notice shall be included in-// all copies or substantial portions of the Software.-//-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN-// THE SOFTWARE.--/* fragment shader for the choropleth-layer */-export default `\--#ifdef GL_ES-precision highp float;-#endif--varying vec4 vColor;--void main(void) {- gl_FragColor = vColor;-}-`;diff --git a/src/deckgl-layers/building-layer/building-layer-vertex.glsl.js b/src/deckgl-layers/building-layer/building-layer-vertex.glsl.jsdeleted file mode 100644index dd0f9d4da..000000000--- a/src/deckgl-layers/building-layer/building-layer-vertex.glsl.js+++ /dev/null@@ -1,110 +0,0 @@-// Copyright (c) 2018 Uber Technologies, Inc.-//-// Permission is hereby granted, free of charge, to any person obtaining a copy-// of this software and associated documentation files (the "Software"), to deal-// in the Software without restriction, including without limitation the rights-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-// copies of the Software, and to permit persons to whom the Software is-// furnished to do so, subject to the following conditions:-//-// The above copyright notice and this permission notice shall be included in-// all copies or substantial portions of the Software.-//-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN-// THE SOFTWARE.--/* vertex shader for the choropleth-layer */-export default `\--#define SHADER_NAME choropleth-layer-vertex-shader--attribute vec3 positions;-attribute vec3 normals;--// projection uniforms-uniform float mercatorScale;-uniform mat4 worldMatrix;-uniform mat4 viewMatrix;-uniform mat4 worldInverseTransposeMatrix;--// Custom uniforms-uniform float pixelPerMeter;-uniform float opacity;-uniform vec3 colors;--// Lighting constants, this can also be set via uniform-const vec3 ambientColor = vec3(1., 1., 1.);-const vec3 pointLocation = vec3(-1., 3., -1.);-const vec3 pointColor = vec3(1., 1., 1.);-const vec3 pointSpecularColor = vec3(0.6, 0.6, 0.6);-const float shininess = 3.;-const float pointLightAmbientCoefficient = 0.8;--varying vec4 vColor;--vec3 getLightWeight(- mat4 viewMatrix,- mat4 worldMatrix,- mat4 worldInverseTransposeMatrix,- vec3 positions,- vec3 normals,- vec3 ambientColor,- vec3 pointLocation,- vec3 pointColor,- vec3 pointSpecularColor,- float shininess,- float pointLightAmbientCoefficient-) {- vec4 vPosition = worldMatrix * vec4(positions, 1.0);- vec4 vTransformedNormal = worldInverseTransposeMatrix * vec4(normals, 1);- vec3 normal = vTransformedNormal.xyz;- vec3 eyeDirection = normalize(-vPosition.xyz);-- vec3 transformedPointLocation = (viewMatrix * vec4(pointLocation, 1.0)).xyz;- vec3 lightDirection = normalize(transformedPointLocation - vPosition.xyz);- vec3 reflectionDirection = reflect(-lightDirection, normal);-- float specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), clamp(shininess, 1., 32.));- vec3 specularLight = specularLightWeighting * pointSpecularColor;-- float diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);- vec3 diffuseLight = diffuseLightWeighting * pointColor;--- return (ambientColor * pointLightAmbientCoefficient) + diffuseLight + specularLight;-}--void main(void) {- // For some reason, need to add one to elevation to show up in untilted mode- vec3 p = vec3(- project_position(positions.xy),- positions.z * pixelPerMeter + .1- );-- gl_Position = project_to_clipspace(vec4(p, 1.));-- vec3 lightWeighting = getLightWeight(- viewMatrix,- worldMatrix,- worldInverseTransposeMatrix,- p,- normals,- ambientColor,- pointLocation,- pointColor,- pointSpecularColor,- shininess,- pointLightAmbientCoefficient- );-- vec3 lightWeightedColor = lightWeighting * colors / 255.0;-- // vec3 color = applyLighting(gl_Position.xyz, normals, colors);- vColor = vec4(color, opacity);-}-`;diff --git a/src/deckgl-layers/building-layer/building-layer.js b/src/deckgl-layers/building-layer/building-layer.jsdeleted file mode 100644index be4606313..000000000--- a/src/deckgl-layers/building-layer/building-layer.js+++ /dev/null@@ -1,361 +0,0 @@-// Copyright (c) 2018 Uber Technologies, Inc.-//-// Permission is hereby granted, free of charge, to any person obtaining a copy-// of this software and associated documentation files (the "Software"), to deal-// in the Software without restriction, including without limitation the rights-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-// copies of the Software, and to permit persons to whom the Software is-// furnished to do so, subject to the following conditions:-//-// The above copyright notice and this permission notice shall be included in-// all copies or substantial portions of the Software.-//-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN-// THE SOFTWARE.--import {Layer, assembleShaders} from 'deck.gl';-import earcut from 'earcut';-import flattenDeep from 'lodash.flattendeep';-import {Model, Geometry} from 'luma.gl';-import {mat4, vec3} from 'gl-matrix';--import vs from './building-layer-vertex.glsl';-import fs from './building-layer-fragment.glsl';--const viewMatrixCompat = mat4.create();-mat4.lookAt(viewMatrixCompat, [0, 0, 0], [0, 0, -1], [0, 1, 0]);-const viewMatrix = new Float32Array(viewMatrixCompat);--export default class BuildingLayer extends Layer {- /**- * @classdesc- * BuildingLayer- *- * @class- * @param {object} props- * @param {bool} props.drawWireframe - ? drawWireframe : drawSolid- * @param {function} props.onBuildingHovered - provide proerties of the- * selected building, together with the mouse event when mouse hovered- * @param {function} props.onBuildingClicked - provide proerties of the- * selected building, together with the mouse event when mouse clicked- */- constructor(props) {- super({- opacity: 1,- ...props- });- }-- initializeState() {- const {gl} = this.context;- const {attributeManager} = this.state;-- attributeManager.addDynamic({- // Primtive attributes- indices: {size: 1, update: this.calculateIndices, isIndexed: true},- positions: {size: 3, update: this.calculatePositions},- // colors: {update: this.calculateColors},- normals: {size: 3, update: this.calculateNormals}- });-- this.setUniforms({opacity: this.props.opacity});-- const IndexType = gl.getExtension('OES_element_index_uint')- ? Uint32Array- : Uint16Array;-- this.setState({- numInstances: 0,- model: this.getModel(gl),- IndexType- });-- this.extractBuildings();- }-- didMount() {- this.updateUniforms();- }-- willReceiveProps(oldProps, newProps) {- super.willReceiveProps(oldProps, newProps);-- const {dataChanged, attributeManager} = this.state;- if (dataChanged) {- this.extractBuildings();-- attributeManager.invalidateAll();- }-- this.updateUniforms();- }-- getShaders() {- return {vs, fs};- }-- getModel(gl) {- return new Model({- ...assembleShaders(gl, this.getShaders()),- geometry: new Geometry({- id: this.props.id,- drawMode: this.props.drawWireframe ? 'LINES' : 'TRIANGLES'- }),- vertexCount: 0,- isIndexed: true- });- }-- draw({uniforms}) {- this.state.model.render({- ...uniforms,- viewMatrix- });- }-- // each top vertex is on 3 surfaces- // each bottom vertex is on 2 surfaces- calculatePositions(attribute) {- const positions = flattenDeep(- this.state.groupedVertices.map(vertices => {- const topVertices = Array.prototype.concat.apply([], vertices);- const baseVertices = topVertices.map(v => [v[0], v[1], 0]);- return this.props.drawWireframe- ? [topVertices, baseVertices]- : [topVertices, topVertices, topVertices, baseVertices, baseVertices];- })- );- attribute.value = new Float32Array(positions);- }-- calculateNormals(attribute) {- const up = [0, 1, 0];-- const normals = this.state.groupedVertices.map(- (vertices, buildingIndex) => {- const topNormals = new Array(countVertices(vertices)).fill(up);- const sideNormals = vertices.map(polygon =>- this.calculateSideNormals(polygon)- );- const sideNormalsForward = sideNormals.map(n => n[0]);- const sideNormalsBackward = sideNormals.map(n => n[1]);-- return this.props.drawWireframe- ? [topNormals, topNormals]- : [- topNormals,- sideNormalsForward,- sideNormalsBackward,- sideNormalsForward,- sideNormalsBackward- ];- }- );-- attribute.value = new Float32Array(flattenDeep(normals));- }-- calculateSideNormals(vertices) {- const numVertices = vertices.length;- const normals = [];-- for (let i = 0; i < numVertices - 1; i++) {- const n = getNormal(vertices[i], vertices[i + 1]);- normals.push(n);- }-- return [[...normals, normals[0]], [normals[0], ...normals]];- }-- calculateIndices(attribute) {- // adjust index offset for multiple buildings- const multiplier = this.props.drawWireframe ? 2 : 5;- const offsets = this.state.groupedVertices.reduce(- (acc, vertices) => [- ...acc,- acc[acc.length - 1] + countVertices(vertices) * multiplier- ],- [0]- );-- const indices = this.state.groupedVertices.map(- (vertices, buildingIndex) =>- this.props.drawWireframe- ? // 1. get sequentially ordered indices of each building wireframe- // 2. offset them by the number of indices in previous buildings- this.calculateContourIndices(vertices, offsets[buildingIndex])- : // 1. get triangulated indices for the internal areas- // 2. offset them by the number of indices in previous buildings- this.calculateSurfaceIndices(vertices, offsets[buildingIndex])- );-- attribute.value = new Uint32Array(flattenDeep(indices));- attribute.target = this.state.gl.ELEMENT_ARRAY_BUFFER;- this.state.model.setVertexCount(attribute.value.length / attribute.size);- }-- extractBuildings() {- const {data} = this.props;-- this.state.buildings = [];-- data.map(building => {- const {properties, geometry} = building;- const {coordinates, type} = geometry;- if (type === 'MultiPolygon') {- const buildings = coordinates.map(coords => ({- coordinates: coords,- properties- }));- this.state.buildings.push(...buildings);- } else {- this.state.buildings.push({coordinates, properties});- }- });-- this.state.groupedVertices = this.state.buildings.map(building => {- var h = building.properties.height || 15;- return building.coordinates.map(polygon =>- polygon.map(coordinate => [coordinate[0], coordinate[1], h])- );- });- }-- calculateContourIndices(vertices, offset) {- const stride = countVertices(vertices);-- return vertices.map(polygon => {- const indices = [offset];- const numVertices = polygon.length;-- // building top- // use vertex pairs for gl.LINES => [0, 1, 1, 2, 2, ..., n-1, n-1, 0]- for (let i = 1; i < numVertices - 1; i++) {- indices.push(i + offset, i + offset);- }- indices.push(offset);-- // building sides- for (let i = 0; i < numVertices - 1; i++) {- indices.push(i + offset, i + stride + offset);- }-- offset += numVertices;- return indices;- });- }-- calculateSurfaceIndices(vertices, offset) {- const stride = countVertices(vertices);- let holes = null;- const quad = [[0, 1], [0, 3], [1, 2], [1, 2], [0, 3], [1, 4]];-- if (vertices.length > 1) {- holes = vertices- .reduce(- (acc, polygon) => [...acc, acc[acc.length - 1] + polygon.length],- [0]- )- .slice(1, vertices.length);- }-- const topIndices = earcut(flattenDeep(vertices), holes, 3).map(- index => index + offset- );-- const sideIndices = vertices.map(polygon => {- const numVertices = polygon.length;- // building top- const indices = [];-- // building sides- for (let i = 0; i < numVertices - 1; i++) {- indices.push(...drawRectangle(i));- }-- offset += numVertices;- return indices;- });-- return [topIndices, sideIndices];-- function drawRectangle(i) {- return quad.map(v => i + v[0] + stride * v[1] + offset);- }- }-- updateUniforms() {- this.calculateUniforms();- const {pixelPerMeter} = this.state;- const {- color,- opacity,- ambientColor,- pointLightColor,- pointLightLocation,- pointLightAmbientCoefficient,- pointLightAttenuation,- materialSpecularColor,- materialShininess- } = this.props;-- this.setUniforms({- pixelPerMeter,- colors: color || [128, 128, 128],- opacity: opacity || 1,- uAmbientColor: ambientColor || [255, 255, 255],- uPointLightAmbientCoefficient: pointLightAmbientCoefficient || 0.1,- uPointLightLocation: pointLightLocation || [0, 0, 0],- uPointLightColor: pointLightColor || [255, 255, 255],- uPointLightAttenuation: pointLightAttenuation || 0.1,- uMaterialSpecularColor: materialSpecularColor || [255, 255, 255],- uMaterialShininess: materialShininess || 1- });- }-- calculateUniforms() {- const DISTANCE_IN_METER = 37.0409;- const pixel0 = this.project({lon: -122, lat: 37.5});- const pixel1 = this.project({lon: -122, lat: 37.5002});-- const dx = pixel0.x - pixel1.x;- const dy = pixel0.y - pixel1.y;- const scale = Math.sqrt(dx * dx + dy * dy) / DISTANCE_IN_METER;-- this.state.pixelPerMeter = scale;- }-}--/*-* helpers-*/-// get normal vector of line segment-function getNormal(p1, p2) {- if (p1[0] === p2[0] && p1[1] === p2[1]) {- return [1, 0, 0];- }-- const degrees2radians = Math.PI / 180;-- const lon1 = degrees2radians * p1[0];- const lon2 = degrees2radians * p2[0];- const lat1 = degrees2radians * p1[1];- const lat2 = degrees2radians * p2[1];-- const a = Math.sin(lon2 - lon1) * Math.cos(lat2);- const b =- Math.cos(lat1) * Math.sin(lat2) -- Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);-- return vec3.normalize([], [b, 0, -a]);-}--// count number of vertices in geojson polygon-function countVertices(vertices) {- return vertices.reduce((count, polygon) => count + polygon.length, 0);-}diff --git a/src/layers/geojson-layer/geojson-layer-icon.js b/src/layers/geojson-layer/geojson-layer-icon.jsindex 8eca23ecd..283d63776 100644--- a/src/layers/geojson-layer/geojson-layer-icon.js+++ b/src/layers/geojson-layer/geojson-layer-icon.js@@ -65,9 +65,9 @@ class GeojsonLayerIcon extends Component {</Base>);}-};+}-GeojsonLayerIcon.displayName = 'GeojsonLayerIcon',+GeojsonLayerIcon.displayName = 'GeojsonLayerIcon';GeojsonLayerIcon.propTypes = propTypes;GeojsonLayerIcon.defaultProps = defaultProps;diff --git a/website/src/components/app.js b/website/src/components/app.jsindex 520960df2..0f8bbd301 100644--- a/website/src/components/app.js+++ b/website/src/components/app.js@@ -19,8 +19,7 @@// THE SOFTWARE.import React, {Component} from 'react';-import styled, {ThemeProvider} from 'styled-components';-import {theme} from '../styles';+import styled from 'styled-components';import {connect} from 'react-redux';const GlobalStyleDiv = styled.div`diff --git a/website/src/components/home.js b/website/src/components/home.jsindex 839c3a4c3..ca500991d 100644--- a/website/src/components/home.js+++ b/website/src/components/home.js@@ -100,35 +100,6 @@ const StyledHomeContent = styled.div``};`;-const GlobalStyleDiv = styled.div`- font-family: ff-clan-web-pro, 'Helvetica Neue', Helvetica, sans-serif;- font-weight: 400;- font-size: 0.875em;- line-height: 1.71429;- color: ${props => props.theme.textColor};-- *,- *:before,- *:after {- -webkit-box-sizing: border-box;- -moz-box-sizing: border-box;- box-sizing: border-box;- }-- ul {- margin: 0;- padding: 0;- }-- li {- margin: 0;- }-- a {- text-decoration: none;- color: ${props => props.theme.labelColor};- }-`;// based on keyframe aniamtion to fade img// http://css3.bradshawenterprises.com/cfimg/diff --git a/website/src/reducers/index.js b/website/src/reducers/index.jsindex 8c3709c55..f03c8b1b2 100644--- a/website/src/reducers/index.js+++ b/website/src/reducers/index.js@@ -22,6 +22,7 @@ import {combineReducers, createStore, applyMiddleware, compose} from 'redux';import {routerReducer} from 'react-router-redux'import {taskMiddleware} from 'react-palm';import thunk from 'redux-thunk';+import window from 'global/window';import {routerMiddleware} from 'react-router-redux';import {hashHistory} from 'react-router';import appReducer from './app';@@ -44,7 +45,6 @@ export const middlewares = [export const enhancers = [applyMiddleware(...middlewares)];-// add redux devtoolsconst composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;