Closed ghost closed 8 years ago
Store data in the markers using the userData
property which is designed for those cases. In the meantime, I will check the marker
object inside the event.
Just fixed the issue I guess. Please try the latest 1.1.0 build! Also just pushed the changes.
Thanks for that fast response Hans. I'll try the latest build.
Hi Hans
I can confirm that the marker pin colours now work with "pinColor" and that "image" also works as intended.
I've installed 2.1.0
The marker does carry some values, i.e. latitude & longitude of the pin, but I can't pass through any custom values.
FYI I tried userData as a value , as an object and as an array. No luck I'm afraid. console log below:
[INFO] : "markerclick" event fired! [INFO] : { [INFO] : bubbles = 1; [INFO] : cancelBubble = 0; [INFO] : marker = "[object TiGooglemapsMarker]"; [INFO] : source = "[object TiGooglemapsMapView]"; [INFO] : type = markerclick; [INFO] : } [INFO] : marker: {"latitude":54.989261,"longitude":-2.602215} [INFO] : source: {"horizontalWrap":true,"visible":true,"mapType":3,"camera":{"zoom":7.8,"longitude":-2.32982517147218,"latitude":55.01347733242592}} [INFO] : "markerinfoclick" event fired! [INFO] : { [INFO] : bubbles = 1; [INFO] : cancelBubble = 0; [INFO] : marker = "[object TiGooglemapsMarker]"; [INFO] : source = "[object TiGooglemapsMapView]"; [INFO] : type = markerinfoclick; [INFO] : } [INFO] : marker: {"latitude":54.989261,"longitude":-2.602215} [INFO] : source: {"horizontalWrap":true,"visible":true,"mapType":3,"camera":{"zoom":7.8,"longitude":-2.32982517147218,"latitude":55.01347733242592}}
Got some missing properties, all together is fixed in the final 2.1.0 which now can be found under the Releases tab. Thanks!
Hi Hans,
I'm trying to listen to an event that originate from clicks on the MarkerInfo label that are associated with a map pin. In particular I would like to open a new window when the user clicks on a MarkerInfo label to show more detailed information about a particular location. So I'll need to pass data to the new window for that location. In the first instance I have added some custom values to the Marker, you'll see that I've added an ID attribute's follows:
var places = Alloy.Collections.places; var data = places.toJSON(); _.each(data, function(d) { var marker = Alloy.Globals.googleMap.createMarker({ latitude: d.latitude, longitude: d.longitude, title: d.name, snippet: d.state, id: 1, icon: "images/imagefiles_location_map_pin_pink6.png" }); mapData.push(marker); }); mapView.addMarkers(mapData);
I guess I must have got something wrong as the "marker" object that is received from the eventListener is empty. I've "JSON.Stringified" the objects for clarity below and I get the following:
On clicking the marker pin:
[INFO] : "markerclick" event fired! [INFO] : { [INFO] : bubbles = 1; [INFO] : cancelBubble = 0; [INFO] : marker = "[object TiGooglemapsMarker]"; [INFO] : source = "[object TiGooglemapsMapView]"; [INFO] : type = markerclick; [INFO] : } [INFO] : marker: {} [INFO] : source: {"horizontalWrap":true,"visible":true,"mapType":3,"camera":{"zoom":7.8,"longitude":-2.32982517147218,"latitude":55.01347733242592}}
On clicking the MarkerInfo label:
[INFO] : "markerinfoclick" event fired! [INFO] : { [INFO] : bubbles = 1; [INFO] : cancelBubble = 0; [INFO] : marker = "[object TiGooglemapsMarker]"; [INFO] : source = "[object TiGooglemapsMapView]"; [INFO] : type = markerinfoclick; [INFO] : } [INFO] : marker: {} [INFO] : source: {"horizontalWrap":true,"visible":true,"mapType":3,"camera":{"zoom":7.8,"longitude":-2.32982517147218,"latitude":55.01347733242592}}
In both cases the marker object is empty. Any ideas where I'm going wrong?
Cheers