From 01c61772eef07a7a9aa1beb9d99ed801721e456a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 27 May 2022 18:36:34 -0700 Subject: Improve route bounds --- modern/src/map/MapRoutePath.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modern/src') diff --git a/modern/src/map/MapRoutePath.js b/modern/src/map/MapRoutePath.js index 5797e6dd..d7cb484d 100644 --- a/modern/src/map/MapRoutePath.js +++ b/modern/src/map/MapRoutePath.js @@ -69,10 +69,10 @@ const MapRoutePath = ({ positions }) => { }); if (coordinates.length) { const bounds = coordinates.reduce((bounds, item) => bounds.extend(item), new maplibregl.LngLatBounds(coordinates[0], coordinates[0])); + const canvas = map.getCanvas(); map.fitBounds(bounds, { - padding: { - top: 50, bottom: 250, left: 25, right: 25, - }, + padding: Math.min(canvas.width, canvas.height) * 0.1, + duration: 0, }); } }, [positions, reportColor]); -- cgit v1.2.3