Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6주차 6차 배포 #446

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ import { useRedrawCanvas } from '@/hooks/useRedraw';
import { zoomMapView } from '@/utils/map/mapUtils';
import { ICluster, useCluster } from '@/hooks/useCluster';
import { MIN_ZOOM } from '@/lib/constants/mapConstants.ts';
import { getUserLocation } from '@/hooks/getUserLocation.ts';

export const MapCanvasForDraw = ({
width,
height,
initialCenter,
initialZoom,
}: IMapCanvasProps) => {
const { lat, lng } = getUserLocation();

const mapRef = useRef<HTMLDivElement>(null);
const canvasRef = useRef<HTMLCanvasElement>(null);
const [projection, setProjection] = useState<naver.maps.MapSystemProjection | null>(null);
Expand Down Expand Up @@ -68,7 +71,7 @@ export const MapCanvasForDraw = ({
if (!mapRef.current) return;

const mapInstance = new naver.maps.Map(mapRef.current, {
center: new naver.maps.LatLng(initialCenter.lat, initialCenter.lng),
center: new naver.maps.LatLng(lat || initialCenter.lat, lng || initialCenter.lng),
zoom: initialZoom,
minZoom: MIN_ZOOM,
maxBounds: new naver.maps.LatLngBounds(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useRedraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const useRedrawCanvas = ({
}

ctx.save();
ctx.translate(point.x, point.y - zoom);
ctx.translate(point.x, point.y + zoom);
ctx.rotate(rotate);
let filteredImage;
if (markerType === MARKER_TYPE.CHARACTER) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/constants/mapConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const KOREA_BOUNDS = {

// 초기 중심점 (대한민국 중앙 근처)
export const DEFAULT_CENTER = {
lat: (KOREA_BOUNDS.sw.lat + KOREA_BOUNDS.ne.lat) / 2,
lng: (KOREA_BOUNDS.sw.lng + KOREA_BOUNDS.ne.lng) / 2,
lat: 37.35921406312911,
lng: 127.10430493337978,
};

export const MIN_ZOOM = 7; // 대한민국 전체가 보이는 최소 줌 레벨
Expand Down
Loading