Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle Marker not rotating with the css transform property on the map. #13202

Open
akash-sidd1218 opened this issue Jun 18, 2024 · 0 comments
Open

Comments

@akash-sidd1218
Copy link

I am using mapbox gl in my react app. And for the vehicle I am having a car icon as a marker. With each lat and lon which I am receiving as prop , I am feeding that data to the marker element and adding it to map like below,
const markerElement = document.createElement('div');
markerElement.style.backgroundImage = url(${markerImgUrl})
markerElement.style.transform = rotate(${direction}deg); // direction is the angle getting received from geolocation api
const marker = new mapboxgl.Marker({ element: markerElement }).setLngLat(lnglat).addTo(map);

However, the transform property over the marker is not working and the vehicle marker is not rotating according to the direction provided in the transform property. Please guide how to resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant