Skip to content

Commit

Permalink
fixed map marker locations
Browse files Browse the repository at this point in the history
  • Loading branch information
stevem-zhou committed Sep 4, 2023
1 parent ee9563c commit ac55be6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,14 @@ export default function Map({
}

const NewItemMarker = () => {
useMapEvents({
const map = useMapEvents({
click(event) {
const { lat, lng } = event.latlng;
setPosition([lat, lng]);
setPosition(event.latlng);
},
});

return position[0] !== centerPosition[0] &&
position[1] !== centerPosition[1] ? (
return (position.lat !== centerPosition[0] &&
position.lng !== centerPosition[1]) ? (
<Marker
className="marker"
draggable={true}
Expand Down

0 comments on commit ac55be6

Please sign in to comment.