aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-27 18:36:34 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-27 18:36:34 -0700
commit01c61772eef07a7a9aa1beb9d99ed801721e456a (patch)
treec2753ed373ba121fb7669ae22fdcf308348d5ffb /modern
parent4f39902f1312b2927859161623e8eb9626b93340 (diff)
downloadtrackermap-web-01c61772eef07a7a9aa1beb9d99ed801721e456a.tar.gz
trackermap-web-01c61772eef07a7a9aa1beb9d99ed801721e456a.tar.bz2
trackermap-web-01c61772eef07a7a9aa1beb9d99ed801721e456a.zip
Improve route bounds
Diffstat (limited to 'modern')
-rw-r--r--modern/src/map/MapRoutePath.js6
1 files changed, 3 insertions, 3 deletions
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]);