-
Notifications
You must be signed in to change notification settings - Fork 918
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
Setting marker icon 'anchor' #55
Comments
Hi @stevesims, Have you fully reviewed the documentation for anchor points? I have achieved this with the code written below. Example:
|
Yes I have. No matter what values I provide to that anchor, the position of the icon for me is not affected (on iOS). The implementation code for setAnchor in Marker.m seems to indicate that this setting should affect the position of the info window, rather than the position of the icon. However createMarker does not do anything with that "anchor" data, so it just gets ignored. |
I have just experimented a little more and it seems I was mistaken! I suppose as a temporary solution, one could change the position of the marker in the file (for example, I have extended the transparent space in my PNG file so that it sits in the centre), but yes, I think this is certainly something that needs to be reviewed. |
Thanks @jskidd3 for your help. Although I've never added the |
Yes, my apologies, I didn't realise but pure coincidence was just giving me the impression the anchor was working for the icon, didn't realise it was the infowindow!. When will 1.0.12 be released? We have circular markers in our application also and this plays a key part. Can you make it so that if we do set an icon anchor, the rotation property makes the icon spin around the anchor point? Thanks |
@jskidd3 You can rotate the icon using |
Sure you can but its based around the bottom centre of the marker. Let's say for example I have a circle, if I set the anchor to the centre (which I can't do yet, I can only set the anchor of the infowindow), the marker should rotate around the centre point (the anchor), does that make sense or should I draw a diagram? |
In your case, do you just need to the |
Isn't that just for the infowindow or does it effect the rotation of the icon as well? |
The map.addMarker({
'position': GOOGLE_TOKYO,
'icon': {
'url': 'www/images/google_tokyo_icon.png',
'anchor': [10, 20]
}
}); |
Perfect, is it a possibility 1.0.12 will be released this weekend?
|
I'll make an effort as much as possible. |
Cool thanks dude!
|
I released the plugin version 1.1.0 (old version name v1.0.12). Please uninstall the plugin, then install it again. |
yes, I know... this is a really old issue, but any chance, that this property didn't make it into the documentation? |
With the Google Maps JS API, one can set the anchor point of a marker icon to be something other than the bottom centre of the icon image. You'd do this by doing something like:
(My pin-only.png is 16x16, so the anchor on the icon is the middle of the icon.)
This doesn't seem to be supported by the plugin.
In my app I'm drawing a circle with the radius of the accuracy of the home location at latLng, and then placing the homePin on top of that. As I can't adjust the anchor point of the marker icon, the marker sits above the centre point of the circle, which looks slightly odd.
The text was updated successfully, but these errors were encountered: