Skip to content

Commit

Permalink
update map functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
midhun-aot committed Aug 30, 2023
1 parent 54300ba commit e7c475e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
8 changes: 4 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"react-icons": "^4.6.0",
"react-leaflet": "^4.2.1",
"react-oidc-context": "^2.2.0",
"react-parcelmap-bc": "^1.1.3",
"react-parcelmap-bc": "^1.1.4",
"react-redux": "^8.0.2",
"react-router-dom": "^6.4.1",
"react-scripts": "5.0.1",
Expand Down
25 changes: 17 additions & 8 deletions map-package/src/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ const Map = (props) => {
const [address, setAddress] = useState("");
const [location, setLocation] = useState([ 48.46762, -123.25458 ]);
const [zoom, setZoom] = useState(13);
const [searchTrue, setSerachTrue] = useState(false);
const [searchTrue, setSerachTrue] = useState(true);
//const [info, setInfo] = useState({});
let info;

useEffect(() => {
if (props.initLocation.length > 0 && props.initLocation !== null && props.initLocation !== undefined && ( location[0] !== props.initLocation[0] || location[1] !== props.initLocation[1] )) {

setSerachTrue(false);
setZoom(18);
setLocation(props.initLocation);
if(!props.readOnly)
{
setShow(true);
}


const timeoutId = setTimeout(()=>{
//setSerachTrue(false);
setZoom(18);
setLocation(props.initLocation);
if(!props.readOnly)
{
setShow(true);
}

},1000);

return () => {
clearTimeout(timeoutId);
};
}
}, [props]);

Expand Down

0 comments on commit e7c475e

Please sign in to comment.