Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Bug] [Jupyter] fix flashing html export when open in window (#756)

Shan Heee0a327638c2
diff --git a/bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.js b/bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.js
index de3126bb4..b8df57833 100644
--- a/bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.js
+++ b/bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.js
@@ -18,9 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
-
-const ReactVirtualized = require('react-virtualized/dist/commonjs');
+import React, {useEffect, useState, useRef} from 'react';
const ReactHelmet = require('react-helmet');
const Helmet = ReactHelmet ? ReactHelmet.Helmet : null;
@@ -34,10 +32,8 @@ import {
import CustomPanelHeaderFactory from './panel-header';
import CustomSidebarFactory from './side-bar';
-const {AutoSizer} = ReactVirtualized;
-
const CustomAddDataButtonFactory = () => {
- const CustomAddDataButton = () => <div/>;
+ const CustomAddDataButton = () => <div />;
return CustomAddDataButton;
};
@@ -49,53 +45,77 @@ const KeplerGl = injectComponents([
const MAPBOX_TOKEN = process.env.MapboxAccessTokenJupyter; // eslint-disable-line
-class App extends React.Component {
- render() {
- return (
- <div>
- {Helmet ? <Helmet>
+function App() {
+ const rootElm = useRef(null);
+ const [windowDimension, setDimension] = useState({});
+
+ const handleResize = () => {
+ if (!rootElm.current) {
+ return;
+ }
+ const {width, height} = rootElm.current.getBoundingClientRect();
+ if (width !== windowDimension.width || height !== windowDimension.height) {
+ setDimension({width, height});
+ }
+ };
+
+ useEffect(() => {
+ window.addEventListener('resize', handleResize);
+ return () => window.removeEventListener('resize', handleResize);
+ }, []);
+
+ return (
+ <div
+ style={{width: '100%', height: `100%`}}
+ ref={rootElm}
+ className="keplergl-widget-container"
+ >
+ {Helmet ? (
+ <Helmet>
<meta charSet="utf-8" />
<title>Kepler.gl Jupyter</title>
- <link rel="stylesheet" href="http://d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css"/>
- <link rel="stylesheet" href="http://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css"/>
- <style type="text/css">{
- `font-family: ff-clan-web-pro, 'Helvetica Neue', Helvetica, sans-serif;
- font-weight: 400;
- font-size: 0.875em;
- line-height: 1.71429;
- *,
- *:before,
- *:after {
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- body {
- margin: 0; padding: 0;
- }
- .kepler-gl .ReactModal__Overlay.ReactModal__Overlay--after-open {
- position: absolute !important;
- }
- `
- }
+ <link
+ rel="stylesheet"
+ href="http://d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css"
+ />
+ <link
+ rel="stylesheet"
+ href="http://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css"
+ />
+ <style type="text/css">
+ {`font-family: ff-clan-web-pro, 'Helvetica Neue', Helvetica, sans-serif;
+ font-weight: 400;
+ font-size: 0.875em;
+ line-height: 1.71429;
+ *,
+ *:before,
+ *:after {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+ body {
+ margin: 0; padding: 0;
+ }
+ .kepler-gl .ReactModal__Overlay.ReactModal__Overlay--after-open {
+ position: absolute !important;
+ }
+ `}
</style>
- </Helmet> : null}
- <div style={{position: 'absolute', width: '100%', height: '100%'}}>
- <AutoSizer>
- {({height, width}) => (
- <KeplerGl
- mapboxApiAccessToken={MAPBOX_TOKEN}
- width={width || 1200}
- height={height || 800}
- appName="Kepler.gl Jupyter"
- version="0.1.0"
- />
- )}
- </AutoSizer>
- </div>
- </div>
- );
- }
+ <script async src="https://www.googletagmanager.com/gtag/js?id=UA-64694404-19"/>
+ <script>{`window.dataLayer=window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'UA-64694404-19', {page_path: '/keplergl-jupyter-widget'});`}</script>
+ </Helmet>
+ ) : null}
+ <KeplerGl
+ mapboxApiAccessToken={MAPBOX_TOKEN}
+ width={windowDimension.width || 800}
+ height={windowDimension.height || 400}
+ appName="Kepler.gl Jupyter"
+ version="0.1.0a9"
+ getMapboxRef={handleResize}
+ />
+ </div>
+ );
}
export default App;
diff --git a/bindings/kepler.gl-jupyter/js/lib/keplergl/components/root.js b/bindings/kepler.gl-jupyter/js/lib/keplergl/components/root.js
index 1a4087e73..57e9bea1a 100644
--- a/bindings/kepler.gl-jupyter/js/lib/keplergl/components/root.js
+++ b/bindings/kepler.gl-jupyter/js/lib/keplergl/components/root.js
@@ -21,21 +21,16 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
-import document from 'global/document';
import App from './app';
-function renderRoot({id, store, height, ele}) {
+function renderRoot({id, store, ele}) {
const Root = () => (
<Provider store={store}>
<App />
</Provider>
);
- const divElmt = document.createElement('div');
- divElmt.setAttribute('id', id);
- divElmt.setAttribute('style', `width: 100%; height: ${height}px`);
-
- ReactDOM.render(<Root />, ele.appendChild(divElmt));
+ ReactDOM.render(<Root />, ele);
}
export default renderRoot;
diff --git a/bindings/kepler.gl-jupyter/js/lib/keplergl/kepler.gl.js b/bindings/kepler.gl-jupyter/js/lib/keplergl/kepler.gl.js
index 3e72eb671..e5fbc1c0f 100644
--- a/bindings/kepler.gl-jupyter/js/lib/keplergl/kepler.gl.js
+++ b/bindings/kepler.gl-jupyter/js/lib/keplergl/kepler.gl.js
@@ -18,9 +18,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {addDataToMap} from 'kepler.gl/actions';
+import {addDataToMap, ActionTypes} from 'kepler.gl/actions';
import {KeplerGlSchema} from 'kepler.gl/schemas';
-import {ActionTypes} from 'kepler.gl/actions';
+import document from 'global/document';
import renderRoot from './components/root';
import createAppStore from './store';
@@ -80,7 +80,7 @@ class KeplerGlJupyter {
// should not update model after first UPDATE_MAP action
// when component first mounted
- if (previousValue !== hash && this.mapUpdateCounter) {
+ if (previousValue !== hash && this.mapUpdateCounter > 2) {
// keplerGl State has changed
log('store state has changed, update model');
log(previousValue);
@@ -101,7 +101,12 @@ class KeplerGlJupyter {
const height = getHeight(that);
- renderRoot({id: this.id, store: this.store, height, ele: that.el});
+ const divElmt = document.createElement('div');
+ divElmt.setAttribute('id', this.id);
+ divElmt.setAttribute('style', `width: 100%; height: ${height}px`);
+ that.el.appendChild(divElmt);
+
+ renderRoot({id: this.id, store: this.store, ele: divElmt});
const data = getData(that);
const config = getConfig(that);
log('<<<<<<<< render finished! >>>>>>>>>');
@@ -172,10 +177,8 @@ export function addDataConfigToKeplerGl({
const results = loadJupyterData(data);
const succeeded = results.filter(r => r && r.data);
log('addDataConfigToKeplerGl');
-
log(succeeded);
log(config);
-
store.dispatch(
addDataToMap({
datasets: succeeded,
diff --git a/bindings/kepler.gl-jupyter/js/lib/keplergl/main.js b/bindings/kepler.gl-jupyter/js/lib/keplergl/main.js
index f41fcca88..89e2ab8db 100644
--- a/bindings/kepler.gl-jupyter/js/lib/keplergl/main.js
+++ b/bindings/kepler.gl-jupyter/js/lib/keplergl/main.js
@@ -29,9 +29,16 @@ const map = (function initKeplerGl() {
const id = 'keplergl-0';
const store = createAppStore();
+ const divElmt = document.createElement('div');
+ divElmt.setAttribute(
+ 'style',
+ 'width: 100vw; height: 100vh; position: absolute'
+ );
+ document.body.appendChild(divElmt);
+
return {
render: () => {
- renderRoot({id, store, ele: document.body});
+ renderRoot({id, store, ele: divElmt});
},
store
};
diff --git a/bindings/kepler.gl-jupyter/js/lib/keplergl/utils.js b/bindings/kepler.gl-jupyter/js/lib/keplergl/utils.js
index 605717906..e3f76c094 100644
--- a/bindings/kepler.gl-jupyter/js/lib/keplergl/utils.js
+++ b/bindings/kepler.gl-jupyter/js/lib/keplergl/utils.js
@@ -61,10 +61,10 @@ function processReceivedData({data, info}) {
info.queryType === 'csv'
? processCsvData(data)
: info.queryType === 'json'
- ? processGeojson(data)
- : info.queryType === 'df'
- ? processDataFrame(data)
- : null;
+ ? processGeojson(data)
+ : info.queryType === 'df'
+ ? processDataFrame(data)
+ : null;
} catch (e) {
console.log(
`Kepler.gl fails to parse data, detected data
diff --git a/bindings/kepler.gl-jupyter/js/package.json b/bindings/kepler.gl-jupyter/js/package.json
index 7e23a61b4..88a1131d3 100644
--- a/bindings/kepler.gl-jupyter/js/package.json
+++ b/bindings/kepler.gl-jupyter/js/package.json
@@ -27,7 +27,6 @@
"add-licence": "uber-licence",
"prepublish": "uber-licence && yarn build",
"build": "npm run clean && uber-licence && webpack --config ./webpack/build.js",
- "build-template": "webpack --config ./webpack/build-html.js --mode development",
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint lib webpack --fix",
"prettier": "prettier --config ./.prettierrc --print-width 80 --single-quote --write lib/**/*.js"
@@ -81,12 +80,11 @@
"dependencies": {
"@jupyter-widgets/base": "^1.0.0",
"global": "^4.3.0",
- "kepler.gl": "^1.1.3",
+ "kepler.gl": "^1.1.8",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-helmet": "^5.2.0",
"react-redux": "^5.1.1",
- "react-virtualized": "^9.18.5",
"redux": "^3.7.2",
"redux-actions": "^2.2.1",
"styled-components": "^4.1.3",
diff --git a/bindings/kepler.gl-jupyter/js/template/keplergl-html.ejs b/bindings/kepler.gl-jupyter/js/template/keplergl-html.ejs
index 76a5eb73d..f3a851273 100644
--- a/bindings/kepler.gl-jupyter/js/template/keplergl-html.ejs
+++ b/bindings/kepler.gl-jupyter/js/template/keplergl-html.ejs
@@ -91,19 +91,25 @@
<script src="<%= htmlWebpackPlugin.options.devServer %>/webpack-dev-server.js" type="text/javascript"></script>
<% } %>
-<% if (htmlWebpackPlugin.options.googleAnalytics) { %>
-<script type="text/javascript">
- window.GoogleAnalyticsObject='ga';window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
-
- <% if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
- ga('create','<%= htmlWebpackPlugin.options.googleAnalytics.trackingId %>','auto');
- <% } else { throw new Error("html-webpack-template requires googleAnalytics.trackingId config"); } %>
-
- <% if (htmlWebpackPlugin.options.googleAnalytics.pageViewOnLoad) { %>
- ga('send','pageview')
- <% } %>
+<script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-64694404-19', {
+ 'storage': 'none',
+ 'clientId': localStorage.getItem('ga:clientId')
+ });
+ ga(function(tracker) {
+ localStorage.setItem('ga:clientId', tracker.get('clientId'));
+ });
+ ga('set', 'checkProtocolTask', null); // Disable file protocol checking.
+ ga('set', 'checkStorageTask', null); // Disable cookie storage checking.
+ ga('set', 'historyImportTask', null); // Disable history checking (requires reading from cookies).
+ ga('set', 'page', 'keplergl-jupyter-html');
+
+ ga('send', 'pageview');
</script>
-<script async defer src="https://www.google-analytics.com/analytics.js" type="text/javascript"></script>
-<% } %>
</body>
</html>
diff --git a/bindings/kepler.gl-jupyter/js/webpack/build-html.js b/bindings/kepler.gl-jupyter/js/webpack/build-html.js
index b2f002b10..49f52a6e4 100644
--- a/bindings/kepler.gl-jupyter/js/webpack/build-html.js
+++ b/bindings/kepler.gl-jupyter/js/webpack/build-html.js
@@ -38,7 +38,6 @@ const VERSIONS = {
reactDom:clearCarats(dependencies['react-dom']),
redux: clearCarats(dependencies.redux),
reactRedux: clearCarats(dependencies['react-redux']),
- reactVirtualized: clearCarats(dependencies['react-virtualized']),
styledComponents: clearCarats(dependencies['styled-components']),
keplergl: clearCarats(dependencies['kepler.gl'])
}
@@ -57,7 +56,6 @@ const externals = [
{'kepler.gl/processors': 'KeplerGl'},
{'kepler.gl/schemas': 'KeplerGl'},
{'kepler.gl/dist/middleware': 'KeplerGl'},
- {'react-virtualized/dist/commonjs': 'ReactVirtualized'},
{'react-helmet': 'Helmet'}
].reduce((accu, ext) => ({
...accu,
@@ -93,7 +91,7 @@ module.exports = (rules, plugins) => ({
inlineSource: '.(js|css)$',
links: [
'http://d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css',
- 'https://api.tiles.mapbox.com/mapbox-gl-js/v0.42.0/mapbox-gl.css'
+ 'https://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css'
],
scripts: [
@@ -101,7 +99,6 @@ module.exports = (rules, plugins) => ({
`https://unpkg.com/react-dom@${VERSIONS.reactDom}/umd/react-dom.production.min.js`,
`https://unpkg.com/redux@${VERSIONS.redux}/dist/redux.js`,
`https://unpkg.com/react-redux@${VERSIONS.reactRedux}/dist/react-redux.min.js`,
- `https://unpkg.com/react-virtualized@${VERSIONS.reactVirtualized}/dist/umd/react-virtualized.js`,
`https://unpkg.com/styled-components@${VERSIONS.styledComponents}/dist/styled-components.min.js`,
// load kepler.gl last
diff --git a/bindings/kepler.gl-jupyter/keplergl/keplergl.py b/bindings/kepler.gl-jupyter/keplergl/keplergl.py
index 267e51321..c822728fd 100644
--- a/bindings/kepler.gl-jupyter/keplergl/keplergl.py
+++ b/bindings/kepler.gl-jupyter/keplergl/keplergl.py
@@ -157,11 +157,12 @@ class KeplerGl(widgets.DOMWidget):
# find open of body
k = keplergl_html.find("<body>")
- data_to_add = self.data if data == None else data_to_json(data, None)
+ data_to_add = data_to_json(self.data, None) if data == None else data_to_json(data, None)
config_to_add = self.config if config == None else config
- # type()
- # print (type(data_to_add))
+ # for key in data_to_add:
+ # print(type(data_to_add[key]))
+
keplergl_data = json.dumps({"config": config_to_add, "data": data_to_add, "options": {"readOnly": read_only}})
cmd = """window.__keplerglDataConfig = {};""".format(keplergl_data)
diff --git a/bindings/kepler.gl-jupyter/notebooks/DataFrame.ipynb b/bindings/kepler.gl-jupyter/notebooks/DataFrame.ipynb
index 04892bc0f..257dd3d32 100644
--- a/bindings/kepler.gl-jupyter/notebooks/DataFrame.ipynb
+++ b/bindings/kepler.gl-jupyter/notebooks/DataFrame.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
@@ -11,7 +11,7 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
@@ -19,12 +19,14 @@
" {'City': ['Buenos Aires', 'Brasilia', 'Santiago', 'Bogota', 'Caracas'],\n",
" 'Country': ['Argentina', 'Brazil', 'Chile', 'Colombia', 'Venezuela'],\n",
" 'Latitude': [-34.58, -15.78, -33.45, 4.60, 10.48],\n",
- " 'Longitude': [-58.66, -47.91, -70.66, -74.08, -66.86]})"
+ " 'Longitude': [-58.66, -47.91, -70.66, -74.08, -66.86],\n",
+ " 'Time': ['2019-09-01 08:00','2019-09-01 09:00','2019-09-01 10:00','2019-09-01 11:00', '2019-09-01 12:00']\n",
+ " })"
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
@@ -32,6 +34,15 @@
" \"version\": \"v1\",\n",
" \"config\": {\n",
" \"visState\": {\n",
+ " \"filters\":[\n",
+ " {\n",
+ " \"dataId\": \"city\",\n",
+ " \"enlarged\": True,\n",
+ " \"name\": \"Time\",\n",
+ " \"type\": \"timeRange\",\n",
+ " \"value\": [1567326664000, 1567330842000]\n",
+ " }\n",
+ " ],\n",
" \"layers\": [\n",
" {\n",
" \"type\": \"point\",\n",
@@ -60,7 +71,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 19,
"metadata": {},
"outputs": [
{
@@ -73,7 +84,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
- "model_id": "27b0f8dde9cc4ab7a4eff1b0ea458101",
+ "model_id": "9d929324ad044aad87c3aca238549d47",
"version_major": 2,
"version_minor": 0
},
@@ -87,25 +98,25 @@
],
"source": [
"import keplergl\n",
- "w1 = keplergl.KeplerGl(height=500, data={\"city\": df}, config=config)\n",
+ "w1 = keplergl.KeplerGl(height=400, data={\"city\": df}, config=config)\n",
"w1"
]
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Map saved to keplergl_map.html!\n"
+ "Map saved to keplergl_map_time_test_1.html!\n"
]
}
],
"source": [
- "w1.save_to_html(data={\"city\": df}, config=config)"
+ "w1.save_to_html(file_name='keplergl_map_time_test_1.html')"
]
}
],
diff --git a/bindings/kepler.gl-jupyter/notebooks/GeoDataFrame.ipynb b/bindings/kepler.gl-jupyter/notebooks/GeoDataFrame.ipynb
index e3a9df2c6..26e604a78 100644
--- a/bindings/kepler.gl-jupyter/notebooks/GeoDataFrame.ipynb
+++ b/bindings/kepler.gl-jupyter/notebooks/GeoDataFrame.ipynb
@@ -155,13 +155,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "Documentation: https://github.com/keplergl/kepler.gl/blob/master/docs/keplergl-jupyter/user-guide.md\n"
+ "User Guide: https://github.com/keplergl/kepler.gl/blob/master/docs/keplergl-jupyter/user-guide.md\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
- "model_id": "efccacd78b484f908063848611b1fd28",
+ "model_id": "8dc26cc0c654404380557a0627f3d771",
"version_major": 2,
"version_minor": 0
},
@@ -199,14 +199,14 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Map saved to city_map.html\n"
+ "Map saved to city_map.html!\n"
]
}
],
@@ -231,7 +231,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
- "version": "2.7.15"
+ "version": "2.7.16"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
diff --git a/examples/custom-theme/package.json b/examples/custom-theme/package.json
index aed85722e..394c0b1ab 100644
--- a/examples/custom-theme/package.json
+++ b/examples/custom-theme/package.json
@@ -5,7 +5,7 @@
},
"dependencies": {
"global": "^4.3.0",
- "kepler.gl": "^1.1.8",
+ "kepler.gl": "^1.1.6",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-palm": "^1.1.2",
diff --git a/examples/custom-theme/src/app.js b/examples/custom-theme/src/app.js
index ae7f7e9f2..a8c098f9e 100644
--- a/examples/custom-theme/src/app.js
+++ b/examples/custom-theme/src/app.js
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React, {Component} from 'react';
+import React, {useEffect, useState} from 'react';
import styled from 'styled-components';
import window from 'global/window';
import {connect} from 'react-redux';
@@ -60,60 +60,46 @@ const StyleSwitch = styled.div`
border: 1px solid mediumseagreen;
`;
-class App extends Component {
- state = {
- customTheme: false,
+function App(props) {
+ const [customTheme, setTheme] = useState(false);
+ const [windowDimension, setDimension] = useState({
width: window.innerWidth,
height: window.innerHeight
- };
+ });
- componentWillMount() {
- // event listeners
- window.addEventListener('resize', this._onResize);
+ useEffect(() => {
+ const handleResize = () => {
+ setDimension({width: window.innerWidth, height: window.innerHeight});
+ };
+ window.addEventListener('resize', handleResize);
+ return () => window.removeEventListener('resize', handleResize);
+ }, []);
- this._onResize();
- }
-
- componentWillUnmount() {
- window.removeEventListener('resize', this._onResize);
- }
-
- _onResize = () => {
- this.setState({
- width: window.innerWidth,
- height: window.innerHeight
- });
- };
-
- _onToggleTheme = (event) => {
- const checked = event.target.checked;
- this.setState({
- customTheme: checked
- })
- };
-
- render() {
- const {width, height, customTheme} = this.state;
- return (
- <div>
- <StyleSwitch>
- <label htmlFor="custom-theme">Custom theme</label>
- <input type="checkbox" checked={customTheme} id="custom-theme" onChange={this._onToggleTheme}/>
- </StyleSwitch>
- <KeplerGl
- mapboxApiAccessToken={MAPBOX_TOKEN}
- id="map"
- /*
- * Specify path to keplerGl state, because it is not mount at the root
- */
- getState={state => state.demo.keplerGl}
- width={width}
- height={height}
- theme={customTheme ? theme : emptyTheme}
+ return (
+ <div>
+ <StyleSwitch>
+ <label htmlFor="custom-theme">Custom theme</label>
+ <input
+ type="checkbox"
+ checked={customTheme}
+ id="custom-theme"
+ onChange={e => setTheme(e.target.checked)}
/>
- </div>
- );
- }
+ </StyleSwitch>
+ <KeplerGl
+ mapboxApiAccessToken={MAPBOX_TOKEN}
+ id="map"
+ /*
+ * Specify path to keplerGl state, because it is not mount at the root
+ */
+ getState={state => state.demo.keplerGl}
+ width={windowDimension.width}
+ height={windowDimension.height}
+ theme={customTheme ? theme : emptyTheme}
+ />
+ </div>
+ );
+ // }
}
const mapStateToProps = state => state;
diff --git a/examples/demo-app/package.json b/examples/demo-app/package.json
index 5a688a3ee..ef7c12b31 100644
--- a/examples/demo-app/package.json
+++ b/examples/demo-app/package.json
@@ -9,7 +9,7 @@
"d3-request": "^1.0.6",
"dropbox": "^4.0.12",
"global": "^4.3.0",
- "kepler.gl": "^1.1.8",
+ "kepler.gl": "^1.1.6",
"lodash.debounce": "^4.0.8",
"lodash.get": "^4.4.2",
"react": "^16.8.4",
diff --git a/examples/node-app/package.json b/examples/node-app/package.json
index 58d33f9c4..bf56c60ad 100644
--- a/examples/node-app/package.json
+++ b/examples/node-app/package.json
@@ -6,7 +6,7 @@
"dependencies": {
"express": "^4.17.1",
"global": "^4.3.0",
- "kepler.gl": "^1.1.8",
+ "kepler.gl": "^1.1.6",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-palm": "^1.1.2",
@@ -47,4 +47,4 @@
"webpack-hot-middleware": "^2.25.0",
"webpack-stats-plugin": "^0.2.1"
}
-}
\ No newline at end of file
+}
diff --git a/examples/open-modal/package.json b/examples/open-modal/package.json
index 27049ba3c..ac331f20e 100644
--- a/examples/open-modal/package.json
+++ b/examples/open-modal/package.json
@@ -5,7 +5,7 @@
},
"dependencies": {
"global": "^4.3.0",
- "kepler.gl": "^1.1.8",
+ "kepler.gl": "^1.1.6",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-modal": "^3.1.10",
diff --git a/examples/replace-component/package.json b/examples/replace-component/package.json
index 170e0d422..002f0462a 100644
--- a/examples/replace-component/package.json
+++ b/examples/replace-component/package.json
@@ -5,7 +5,7 @@
},
"dependencies": {
"global": "^4.3.0",
- "kepler.gl": "^1.1.8",
+ "kepler.gl": "^1.1.6",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-palm": "^1.1.2",
diff --git a/examples/umd-client/index.html b/examples/umd-client/index.html
index 609deae33..bb04c1130 100644
--- a/examples/umd-client/index.html
+++ b/examples/umd-client/index.html
@@ -18,7 +18,7 @@
<script src="https://unpkg.com/[email protected]/dist/styled-components.min.js" crossorigin></script>
<!-- Load Kepler.gl-->
- <script src="https://unpkg.com/[email protected]/umd/keplergl.min.js"></script>
+ <script src="https://unpkg.com/[email protected]/umd/keplergl.min.js"></script>
<!--If you want to load the build from filepath -->
<!--<script src="../../umd/keplergl.min.js"></script>-->
diff --git a/src/components/common/range-slider.js b/src/components/common/range-slider.js
index 5b0467198..1a89b6364 100644
--- a/src/components/common/range-slider.js
+++ b/src/components/common/range-slider.js
@@ -198,7 +198,7 @@ export default class RangeSlider extends Component {
const height = isRanged && showInput ? '16px' : '24px';
const {width} = this.state;
- const plotWidth = width - sliderHandleWidth;
+ const plotWidth = Math.max(width - sliderHandleWidth, 0);
return (
<div