Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1019)

Unified Diff: lib/src/google-map/google-map-search.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/google-map/google-map-poly.html ('k') | lib/src/google-signin/google-signin.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/google-map/google-map-search.html
diff --git a/lib/src/google-map/google-map-search.html b/lib/src/google-map/google-map-search.html
index 49d5a5ba1a91dac331c2596ae57c860962f01483..4554a348954209e1eba059a4dcbc7a46733a9ba8 100644
--- a/lib/src/google-map/google-map-search.html
+++ b/lib/src/google-map/google-map-search.html
@@ -11,8 +11,8 @@ information on the API.
#### Example:
<template is="dom-bind">
- <google-map-search map="[[map]]" libraries="places" query="Pizza"
- results="{{results}}"></google-map-search>
+ <google-map-search map="[[map]]" query="Pizza" results="{{results}}">
+ </google-map-search>
<google-map map="{{map}}" latitude="37.779"
longitude="-122.3892">
<template is="dom-repeat" items="{{results}}" as="marker">
@@ -119,7 +119,7 @@ information on the API.
location: {
type: Object,
value: null,
- readyOnly: true
+ readOnly: true
}
},
@@ -129,13 +129,17 @@ information on the API.
],
/**
+ * Fired when the details of a place are returned.
+ *
+ * @event google-map-search-place-detail
+ * @param {google.maps.MarkerPlace} detail The place details.
+ */
+
+ /**
* Fired when the search element returns a result.
*
* @event google-map-search-results
- * @param {Array} detail An array of search results
- * @param {number} detail.latitude Latitude of the result.
- * @param {number} detail.longitude Longitude of the result.
- * @param {bool} detail.show Whether to show the result on the map.
+ * @param {Array<{latitude: number, longitude: number}>} detail An array of search results
*/
/**
@@ -166,6 +170,26 @@ information on the API.
}
},
+ /**
+ * Fetches details for a given place.
+ * @param {String} placeId The place id.
+ * @return {Promise} place The place information.
+ */
+ getDetails: function(placeId) {
+ var places = new google.maps.places.PlacesService(this.map);
+
+ return new Promise(function(resolve, reject) {
+ places.getDetails({placeId: placeId}, function(place, status) {
+ if (status === google.maps.places.PlacesServiceStatus.OK) {
+ resolve(place);
+ this.fire('google-map-search-place-detail', place);
+ } else {
+ reject(status);
+ }
+ }.bind(this));
+ }.bind(this));
+ },
+
_gotResults: function(results, status) {
this.results = results.map(function(result) {
// obtain lat/long from geometry
« no previous file with comments | « lib/src/google-map/google-map-poly.html ('k') | lib/src/google-signin/google-signin.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698