@@ -27,10 +27,9 @@ import Map from "./map-comparison";
2727
2828const h = hyper . styled ( styles ) ;
2929
30- function VisControl ( { show, setShown, name } ) {
30+ function VisControl ( { show, setShown, name, children } ) {
3131 const className = show ? "active" : "" ;
32- return h (
33- "li" ,
32+ return h ( "li.vis-control" , [
3433 h (
3534 "a" ,
3635 {
@@ -40,8 +39,9 @@ function VisControl({ show, setShown, name }) {
4039 } ,
4140 } ,
4241 [ show ? "Hide" : "Show" , " " , name ]
43- )
44- ) ;
42+ ) ,
43+ children ,
44+ ] ) ;
4545}
4646
4747function getStartingPosition ( ) : MapPosition {
@@ -75,17 +75,20 @@ function App({ accessToken }) {
7575 const style = "mapbox://styles/jczaplewski/cklb8aopu2cnv18mpxwfn7c9n" ;
7676 const [ showWireframe , setShowWireframe ] = useState ( false ) ;
7777 const [ showInspector , setShowInspector ] = useState ( false ) ;
78- const [ useGoogleTiles , setUseGoogleTiles ] = useState ( false ) ;
78+ const [ showGoogleTiles , setShowGoogleTiles ] = useState ( false ) ;
7979 const [ showMapbox , setShowMapbox ] = useState ( false ) ;
8080 const [ showGeology , setShowGeology ] = useState ( false ) ;
8181 const [ position , setPosition ] = useState < MapPosition > (
8282 initialPosition . current
8383 ) ;
8484
85+ const googleMapsAPIKey = import . meta. env . VITE_GOOGLE_MAPS_API_KEY ;
86+
8587 const queryString = useRef < object > ( { } ) ;
8688
8789 useEffect ( ( ) => {
8890 let hashData = { } ;
91+ console . log ( "Updated position" ) ;
8992 applyMapPositionToHash ( hashData , position ) ;
9093 queryString . current = buildQueryString ( hashData ) ;
9194 setHashString ( hashData ) ;
@@ -105,6 +108,7 @@ function App({ accessToken }) {
105108 }
106109
107110 const onViewChange = useCallback ( ( cpos : CameraParams ) => {
111+ console . log ( "View changed" ) ;
108112 const { camera } = cpos ;
109113 setPosition ( {
110114 camera : {
@@ -138,8 +142,8 @@ function App({ accessToken }) {
138142 } ) ,
139143 h ( VisControl , {
140144 name : "Google tiles" ,
141- show : useGoogleTiles ,
142- setShown : setUseGoogleTiles ,
145+ show : showGoogleTiles ,
146+ setShown : setShowGoogleTiles ,
143147 } ) ,
144148 h ( VisControl , {
145149 name : "geology" ,
@@ -159,10 +163,11 @@ function App({ accessToken }) {
159163 showWireframe,
160164 showInspector,
161165 showGeology,
162- useGoogleTiles ,
166+ showGoogleTiles ,
163167 highResolution : true ,
164168 displayQuality : DisplayQuality . High ,
165169 onViewChange,
170+ googleMapsAPIKey,
166171 } ) ,
167172 ] ) ,
168173 h . if ( showMapbox ) ( "div.map-panel" , [
0 commit comments