When I show a marker in the center of the map it is OK. But when I zoom out, the marker is like staying at the same place. Finally its position is very wrong.
Why is it not moving together with the map when zooming out?
I user react-leaflet:
const customMarker = new L.icon({
iconUrl: '/images/icons/location-pointer.svg',
iconSize: new L.Point(35, 46),
});
...
renderMarker(position) {
if (position) {
return (
<Marker
position={[position.lat, position.lng]}
icon={customMarker}
>
</Marker>
);
}
}
...
render() {
return (
<Map
ref={this.mapRef}
center={positionMap}
zoom={position.zoom}
onClick={this.handleClick}
onMoveend={this.handleMoveEnd}
dragging={true}
scrollWheelZoom={false}
>
<TileLayer
attribution="&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors"
url="https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}"
/>
{ this.renderMarker(this.props.locationData.locations[0]) }
</Map>
);
}
}