From 87dd77fac53a7e4ab26b6279672525fd4fe872db Mon Sep 17 00:00:00 2001 From: JANGHYUNn Date: Fri, 7 Jun 2024 17:57:53 +0900 Subject: [PATCH] =?UTF-8?q?mapbox=20fitbound=20issue=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utility/MapUtils.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utility/MapUtils.js b/src/utility/MapUtils.js index bc1d8f66..bf064151 100644 --- a/src/utility/MapUtils.js +++ b/src/utility/MapUtils.js @@ -156,8 +156,14 @@ export const handlerFitBounds = (map, paths, padding, type, page) => { bounds.extend(paths[i]); } } + console.log(bounds); if (page === 'flight') { - map.fitBounds(bounds, { padding: padding, offset: { x: -150, y: 0 } }); + const syncPadding = Math.min( + padding, + window.innerWidth / 4, + window.innerHeight / 4 + ); + map.fitBounds(bounds, { padding: syncPadding, offset: { x: -150, y: 0 } }); } else { map.fitBounds(bounds, { padding: padding }); }