From fa79ee736fb1e5d7d6fda9c77016cf92c2c6a71c Mon Sep 17 00:00:00 2001 From: Amirhossein Mahmoodi Date: Mon, 6 Jan 2025 10:51:57 +0330 Subject: [PATCH] change icon size --- src/core/components/MapInfoTwoMarker.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/components/MapInfoTwoMarker.jsx b/src/core/components/MapInfoTwoMarker.jsx index daac893..5034cb7 100644 --- a/src/core/components/MapInfoTwoMarker.jsx +++ b/src/core/components/MapInfoTwoMarker.jsx @@ -23,8 +23,8 @@ const createCustomIcon = (size, iconUrl, labelText, color) => {
`, - iconSize: [100, 50], // Adjust icon size to fit your content - iconAnchor: [50, 25], // Adjust to position the marker correctly + iconSize: [50, 50], + iconAnchor: [25, 50], }); } return L.icon({ @@ -111,6 +111,7 @@ const MapInteraction = ({ setValue, startLat, startLng, endLat, endLng }) => { setStartPosition({ lat: center.lat, lng: center.lng }); setIsStartLocked(true); setStartIconColor("#1CAC66"); + map.panBy([25, 25]) } }, }} @@ -182,6 +183,13 @@ const MapInteraction = ({ setValue, startLat, startLng, endLat, endLng }) => { setEndPosition({ lat: center.lat, lng: center.lng }); setIsEndLocked(true); setEndIconColor("#D13131"); + map.fitBounds( + [ + startPosition, + map.getCenter(), + ], + { paddingTopLeft: [16, 16], paddingBottomRight: [16, 16] } + ); } }, }}