From b4f1a48ba85c085ccdca39ac6a111a15f7e39936 Mon Sep 17 00:00:00 2001 From: afds4567 <33995840+afds4567@users.noreply.github.com> Date: Thu, 3 Aug 2023 15:26:57 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=ED=95=80=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/hooks/useAnimateClickedPin.ts | 2 +- frontend/src/pages/Home.tsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/hooks/useAnimateClickedPin.ts b/frontend/src/hooks/useAnimateClickedPin.ts index a1ce6f3e..967142e0 100644 --- a/frontend/src/hooks/useAnimateClickedPin.ts +++ b/frontend/src/hooks/useAnimateClickedPin.ts @@ -9,7 +9,7 @@ const useAnimateClickedPin = (map: any, markers: any) => { const marker = markers.find((marker: any) => marker.id === pinId); if (marker) { map.setCenter(marker.getPosition()); - map.setZoom(14); + map.setZoom(17); marker._marker_data.options.animation = window.Tmapv2.MarkerOptions.ANIMATE_BALLOON; marker._marker_data.options.animationLength = 500; diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index f4b5e159..2315961b 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -4,16 +4,18 @@ import TopicCard from '../components/TopicCard'; import Button from '../components/common/Button'; import Flex from '../components/common/Flex'; import Box from '../components/common/Box'; -import { Fragment, useEffect, useState } from 'react'; +import { Fragment, useContext, useEffect, useState } from 'react'; import { getApi } from '../utils/getApi'; import { TopicType } from '../types/Topic'; import useNavigator from '../hooks/useNavigator'; import { MergeOrSeeTogether } from '../components/MergeOrSeeTogether'; +import { MarkerContext } from '../context/MarkerContext'; const Home = () => { const [topics, setTopics] = useState([]); const [taggedTopicIds, setTaggedTopicIds] = useState([]); const [tagTopics, setTagTopics] = useState([]); + const { markers, removeMarkers } = useContext(MarkerContext); const { routePage } = useNavigator(); const goToNewTopic = () => { @@ -37,6 +39,7 @@ const Home = () => { // 현재 위치 받아오기 useEffect(() => { getAndSetDataFromServer(); + if (markers.length > 0) removeMarkers(); }, []); return (