Browse Source

비행구역 - 좌표 수정 시 이동현상 수정

pull/2/head
junh_eee(이준희) 2 years ago
parent
commit
cf8aa1f906
  1. 27
      src/components/basis/flight/plan/FlightPlanAreaMap.js

27
src/components/basis/flight/plan/FlightPlanAreaMap.js

@ -38,9 +38,11 @@ const FlightPlanAreaMap = props => {
const [searchRes, setSearchRes] = useState([]); const [searchRes, setSearchRes] = useState([]);
const [isSearch, setIsSearch] = useState(false); const [isSearch, setIsSearch] = useState(false);
const [dragSize, setDragSize] = useState(140); const [dragSize, setDragSize] = useState(70);
const [pastDragCircle, setDragCircle] = useState([]); const [pastDragCircle, setDragCircle] = useState([]);
const [number, setNumber] = useState(0);
useEffect(() => { useEffect(() => {
NaverMapInit(); NaverMapInit();
return () => { return () => {
@ -66,18 +68,21 @@ const FlightPlanAreaMap = props => {
areaCoordList[0].coordList[0].lat !== 0 && areaCoordList[0].coordList[0].lat !== 0 &&
areaCoordList[0].coordList[0].lon !== 0 areaCoordList[0].coordList[0].lon !== 0
) { ) {
if (map) { if (number === 0) {
map.setCenter( if (map) {
new naver.maps.LatLng( map.setCenter(
areaCoordList[0].coordList[0].lat, new naver.maps.LatLng(
areaCoordList[0].coordList[0].lon areaCoordList[0].coordList[0].lat,
) areaCoordList[0].coordList[0].lon
); )
setMapAreaCoordList(areaCoordList); );
setNumber(number + 1);
}
} }
setMapAreaCoordList(areaCoordList);
} }
} }
}, [areaCoordList, map]); }, [areaCoordList, map, number]);
const ModeInit = () => { const ModeInit = () => {
setMode(mapControl.drawType); setMode(mapControl.drawType);
@ -108,7 +113,7 @@ const FlightPlanAreaMap = props => {
const mapOptions = { const mapOptions = {
// center: new naver.maps.LatLng(36.56793936069445, 127.85101412107547), // center: new naver.maps.LatLng(36.56793936069445, 127.85101412107547),
center: new naver.maps.LatLng(37.520357, 126.610166), center: new naver.maps.LatLng(37.520357, 126.610166),
zoom: !areaCoordList ? 13 : bufferzoom.bufferzoom, zoom: !areaCoordList ? 14 : bufferzoom.bufferzoom,
zoomControl: true, zoomControl: true,
mapTypeId: naver.maps.MapTypeId.NORMAL, mapTypeId: naver.maps.MapTypeId.NORMAL,
zoomControlOptions: { zoomControlOptions: {

Loading…
Cancel
Save