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

Marker Icon Misalignment with Custom SVG Path in @react-google-maps/api #3340

Open
m-alhoomaidi opened this issue Feb 25, 2024 · 0 comments
Open

Comments

@m-alhoomaidi
Copy link

m-alhoomaidi commented Feb 25, 2024

An explanation of the issue

When utilizing a custom SVG path for a marker icon with the Marker component in @react-google-maps/api, there's a significant misalignment between the intended click location on the map and where the marker is actually rendered. This issue impacts the precision of marker placement, which is essential for user interactions within our application.

Environment

os: linux

node --version 21.5.0

react version 18.2.0

@react-google-maps/api version:^2.19.3

How does it behave?

Currently, when using a custom SVG path as an icon for the Marker component, the marker does not align correctly with the specified coordinates on the map. Despite the position prop being set accurately according to the location where the map is clicked, the rendered marker appears offset from this location. This behavior is consistent across various browsers and zoom levels on the map. The discrepancy between the click location and the marker's position creates confusion, as the visual indication of the marker does not match the expected geographical point on the map.

How should it behave correctly?

The marker should be rendered precisely at the coordinates specified by the position prop, with no visible offset or misalignment. When a user clicks on a specific point on the map, and a marker is programmatically placed at this point using a custom SVG icon, the tip of the marker icon (or its designated anchor point) should coincide exactly with the clicked location. This behavior would ensure that the visual representation provided by the marker accurately reflects the intended geographical location, enhancing the user experience by providing clear and accurate visual cues.

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