diff --git a/src/components/map/nhn/NMapMarker.js b/src/components/map/nhn/NMapMarker.js index 5cc6c3c2..010abe6d 100644 --- a/src/components/map/nhn/NMapMarker.js +++ b/src/components/map/nhn/NMapMarker.js @@ -71,7 +71,33 @@ export const NMapMarker = props => { props.marker.remove(); } - props.map.flyTo({ center: position, zoom: 14 }); + const bounds = new mapboxgl.LngLatBounds( + props.data[0][0], + props.data[0][1] + ); + + // Extend the 'LngLatBounds' to include every coordinate in the bounds result. + // bounds.extend(); + + // props.map.fitBounds(bounds, { + // padding: { + // top: 0, + // right: 0, + // bottom: 400, // 하단에 패딩 추가 + // left: 350 + // }, + // zoom: 13 + // }); + props.map.flyTo({ + center: position, + zoom: 13, + padding: { + top: 0, + right: 0, + bottom: 400, // 하단에 패딩 추가 + left: 350 + } + }); const newMarker = new mapboxgl.Marker(el) .setLngLat(position)