Show feature table on hover

This commit is contained in:
Lukas Martinelli
2016-12-24 15:14:31 +01:00
parent 6e9e66b147
commit def5ebb587
4 changed files with 96 additions and 2 deletions

View File

@@ -1,14 +1,15 @@
import React from 'react'
import MapboxGl from 'mapbox-gl'
import validateColor from 'mapbox-gl-style-spec/lib/validate/validate_color'
import style from '../../libs/style.js'
import 'mapbox-gl/dist/mapbox-gl.css'
export default class MapboxGlMap extends React.Component {
static propTypes = {
onDataChange: React.PropTypes.func,
mapStyle: React.PropTypes.object.isRequired,
accessToken: React.PropTypes.string,
style: React.PropTypes.object,
}
static defaultProps = {
@@ -37,6 +38,9 @@ export default class MapboxGlMap extends React.Component {
style: this.props.mapStyle,
})
const nav = new MapboxGl.NavigationControl();
map.addControl(nav, 'top-right');
map.on("style.load", () => {
this.setState({ map });
})
@@ -58,6 +62,7 @@ export default class MapboxGlMap extends React.Component {
bottom: 0,
height: "100%",
width: "100%",
...this.props.style,
}}></div>
}
}