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 click default behaviour #174

Closed
webalchemist opened this issue Aug 27, 2014 · 9 comments
Closed

Marker click default behaviour #174

webalchemist opened this issue Aug 27, 2014 · 9 comments
Labels
Milestone

Comments

@webalchemist
Copy link
Contributor

There appears to be a default click behaviour on markers which centres the map on the marker location.

Is there a way to remove this?

I would essentially like to be able to make a marker non-clickable.

@wf9a5m75
Copy link
Member

Google Maps Android API v2 does not provide the way. Thus, this plugIn does not.

@wf9a5m75
Copy link
Member

Use GroundOverlay with your marker image instead of marker.

@webalchemist
Copy link
Contributor Author

Thanks for the reply.
Unfortunately, a GroundOverlay won't work for me. I need the Marker to stay upright and not rotate with the map - they have numbers on then and need to be read easily.

I've had a look and it is possible to do this within Google Maps Android API v2. See the following discussion of the subject:
http://stackoverflow.com/questions/14497734/dont-snap-to-marker-after-click-in-android-map-v2

It appears that what I have to do is to create a click event handler on the marker that does nothing but returns true to prevent the default handler from running.

The plugin currently seems to have a hardcoded return from the event handler of false (GoogleMaps.java line 954). Would it be possible to change this function so that it returns the result from the javascript handler (defaulting to false).

@wf9a5m75
Copy link
Member

Ah, i forgot the return value.
By the way, the ground overlay is clickable in this plugin.
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/GroundOverlay#click-event

Cordova does not support the mechanism that returns value from javascript.

@webalchemist
Copy link
Contributor Author

Well, I guess that leaves me hacking it!

I can manually change GoogleMaps.java line 954 to return true. This does stop the event bubbling-up and blocks the default behaviour.

@wf9a5m75
Copy link
Member

Implemented in v1.2.0

@wf9a5m75
Copy link
Member

I added the disableAutoPan property for map.addMarker().
You can also change via marker.setDisableAutoPan( true / false )

Please try the new version of the plugin.
This problem should be fixed.
https://plus.google.com/112861993350247152906/posts/ber5LChbWkU

@webalchemist
Copy link
Contributor Author

That's great!
I'll give version 1.2 a try and let you know.
When do you expect 1.2 to have a full release version?

@webalchemist
Copy link
Contributor Author

Works perfectly on Android (haven't tried iOS)

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

No branches or pull requests

2 participants