diff --git a/src/pages/Home/App.js b/src/pages/Home/App.js
index 248b621..f8c0c63 100644
--- a/src/pages/Home/App.js
+++ b/src/pages/Home/App.js
@@ -52,10 +52,10 @@ const App = () => {
{map && }
{map && }
-
- {/* {showZoomFrontLoadScreen && (
+ {/* */}
+ {showZoomFrontLoadScreen && (
setShowZoomFrontLoadScreen(false)} />
- )} */}
+ )}
);
};
diff --git a/src/pages/Map/BaseMap.js b/src/pages/Map/BaseMap.js
index 51c1117..28926aa 100644
--- a/src/pages/Map/BaseMap.js
+++ b/src/pages/Map/BaseMap.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useRef } from "react";
+import React, { useEffect, useRef, useState } from "react";
import mapboxgl from "mapbox-gl";
import './BaseMap.css'; // Ensure this path is correct
@@ -6,6 +6,8 @@ mapboxgl.accessToken = "pk.eyJ1IjoiamFja3JvYiIsImEiOiJjanZ1bDBrdjUxYmgyNGJtczlxd
const BaseMap = ({ center, zoom, setMap }) => {
const mapContainer = useRef(null);
+ const [is3D, setIs3D] = useState(false); // Manage 3D state
+
useEffect(() => {
const map = new mapboxgl.Map({
@@ -16,14 +18,34 @@ const BaseMap = ({ center, zoom, setMap }) => {
interactive: true,
});
- setMap(map); // Optional: Store the map instance in the parent component's state for further use
+ setMap(map); // Optional: Store the map instance
+
+ map.on('load', () => {
+ // Example: Adjust a layer to 3D when 'is3D' is true
+ if (is3D) {
+ map.setPaintProperty('your_layer_id', 'fill-extrusion-height', 20);
+ // Add additional adjustments for 3D view
+ } else {
+ map.setPaintProperty('your_layer_id', 'fill-extrusion-height', 0);
+ // Adjust settings back for 2D view
+ }
+ });
return () => {
- map.remove(); // Cleanup map instance on component unmount
+ map.remove(); // Cleanup
};
- }, [center, zoom]); // React to changes in 'center' and 'zoom'
+ }, [center, zoom, is3D]); // React to changes
+
+ const toggle3D = () => {
+ setIs3D(!is3D); // Toggle 3D state
+ };
- return ;
+ return (
+ <>
+
+
+ >
+ );
};
export default BaseMap;
diff --git a/src/pages/StartingZoom/index.js b/src/pages/StartingZoom/index.js
index 62ff2b6..c147c56 100644
--- a/src/pages/StartingZoom/index.js
+++ b/src/pages/StartingZoom/index.js
@@ -40,7 +40,7 @@ const ZoomFrontLoadScreen = ({onZoom, onOtherAction}) => {
left: 0,
width: "100vw",
height: "100vh",
- backgroundColor: `rgba(61, 169, 222, ${backgroundOpacity})`, // Set background opacity dynamically
+ backgroundColor: `rgba(52,152,219, ${backgroundOpacity})`, // Set background opacity dynamically
display: "flex",
justifyContent: "center",
alignItems: "center",