@@ -32,6 +32,17 @@ const INITIAL_VIEW_STATE = {
3232const BUILDING_DATA =
3333 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/google-3d-tiles/buildings.geojson' ;
3434
35+ function getTooltip ( { object} ) {
36+ return (
37+ object && {
38+ html : `\
39+ <div><b>Distance to nearest tree</b></div>
40+ <div>${ object . properties . distance_to_nearest_tree } </div>
41+ `
42+ }
43+ ) ;
44+ }
45+
3546export default function App ( { data = TILESET_URL , distance = 0 , opacity = 0.2 } ) {
3647 const [ credits , setCredits ] = useState ( '' ) ;
3748
@@ -64,7 +75,8 @@ export default function App({data = TILESET_URL, distance = 0, opacity = 0.2}) {
6475 getFillColor : ( { properties} ) => colorScale ( properties . distance_to_nearest_tree ) ,
6576 opacity,
6677 getFilterValue : f => f . properties . distance_to_nearest_tree ,
67- filterRange : [ distance , 500 ]
78+ filterRange : [ distance , 500 ] ,
79+ pickable : true
6880 } )
6981 ] ;
7082
@@ -75,6 +87,7 @@ export default function App({data = TILESET_URL, distance = 0, opacity = 0.2}) {
7587 initialViewState = { INITIAL_VIEW_STATE }
7688 controller = { { touchRotate : true , inertia : 250 } }
7789 layers = { layers }
90+ getTooltip = { getTooltip }
7891 />
7992 < div
8093 style = { { position : 'absolute' , left : '8px' , bottom : '4px' , color : 'white' , fontSize : '10px' } }
0 commit comments