Commit eb240478119c4d8dd036d98fc85e6fee94c51167
1 parent
ec5b0925
public room cards disposition update
Showing
1581 changed files
with
53425 additions
and
4950 deletions
Too many changes.
To preserve performance only 100 of 1581 files are displayed.
bower_components/google-apis/.bower.json
100755 → 100644
1 | 1 | { |
2 | 2 | "name": "google-apis", |
3 | - "version": "1.1.0", | |
3 | + "version": "1.1.2", | |
4 | 4 | "description": "Web components to load Google API libraries", |
5 | - "homepage": "https://googlewebcomponents.github.io/google-apis", | |
5 | + "homepage": "https://elements.polymer-project.org/elements/google-apis?active=google-js-api", | |
6 | 6 | "main": "google-apis.html", |
7 | 7 | "authors": [ |
8 | 8 | "Scott Miles <sjmiles@google.com>", |
... | ... | @@ -27,13 +27,13 @@ |
27 | 27 | "devDependencies": { |
28 | 28 | "iron-component-page": "PolymerElements/iron-component-page#^1.0.0" |
29 | 29 | }, |
30 | - "_release": "1.1.0", | |
30 | + "_release": "1.1.2", | |
31 | 31 | "_resolution": { |
32 | 32 | "type": "version", |
33 | - "tag": "1.1.0", | |
34 | - "commit": "7fa2ff1da3d6a2bd5891b7441d89fd8ffbf0d83d" | |
33 | + "tag": "1.1.2", | |
34 | + "commit": "5d0d4e8eb3d67d1e21be9f2209e25fc98381718a" | |
35 | 35 | }, |
36 | 36 | "_source": "git://github.com/GoogleWebComponents/google-apis.git", |
37 | - "_target": "^1.1.0", | |
37 | + "_target": "^1.1.1", | |
38 | 38 | "_originalSource": "GoogleWebComponents/google-apis" |
39 | 39 | } |
40 | 40 | \ No newline at end of file | ... | ... |
bower_components/google-apis/LICENSE
100755 → 100644
bower_components/google-apis/README.md
100755 → 100644
bower_components/google-apis/bower.json
100755 → 100644
1 | 1 | { |
2 | 2 | "name": "google-apis", |
3 | - "version": "1.1.0", | |
3 | + "version": "1.1.2", | |
4 | 4 | "description": "Web components to load Google API libraries", |
5 | - "homepage": "https://googlewebcomponents.github.io/google-apis", | |
5 | + "homepage": "https://elements.polymer-project.org/elements/google-apis?active=google-js-api", | |
6 | 6 | "main": "google-apis.html", |
7 | 7 | "authors": [ |
8 | 8 | "Scott Miles <sjmiles@google.com>", | ... | ... |
bower_components/google-apis/demo/index.html
100755 → 100644
bower_components/google-apis/google-apis.html
100755 → 100644
bower_components/google-apis/google-client-loader.html
100755 → 100644
... | ... | @@ -77,13 +77,11 @@ For loading `gapi.client` libraries |
77 | 77 | * You can find the full list of APIs on the |
78 | 78 | * <a href="https://developers.google.com/apis-explorer"> Google APIs |
79 | 79 | * Explorer</a>. |
80 | - * @required | |
81 | 80 | */ |
82 | 81 | name: String, |
83 | 82 | |
84 | 83 | /** |
85 | 84 | * Version of the API to load, e.g. 'v1'. |
86 | - * @required | |
87 | 85 | */ |
88 | 86 | version: String, |
89 | 87 | ... | ... |
bower_components/google-apis/google-js-api.html
100755 → 100644
bower_components/google-apis/google-legacy-loader.html
100755 → 100644
bower_components/google-apis/google-maps-api.html
100755 → 100644
... | ... | @@ -26,7 +26,7 @@ Dynamically loads the Google Maps JavaScript API, firing the `api-load` event wh |
26 | 26 | |
27 | 27 | Any number of components can use `<google-maps-api>` elements, and the library will only be loaded once. |
28 | 28 | |
29 | -@blurb Element wrapper around Google Maps API. | |
29 | +@summary Element wrapper around Google Maps API. | |
30 | 30 | |
31 | 31 | */ |
32 | 32 | Polymer({ |
... | ... | @@ -63,15 +63,6 @@ Any number of components can use `<google-maps-api>` elements, and the library w |
63 | 63 | }, |
64 | 64 | |
65 | 65 | /** |
66 | - * The libraries to load with this map. For more information | |
67 | - * see https://developers.google.com/maps/documentation/javascript/libraries. | |
68 | - */ | |
69 | - libraries: { | |
70 | - type: String, | |
71 | - value: '' | |
72 | - }, | |
73 | - | |
74 | - /** | |
75 | 66 | * Version of the Maps API to use. |
76 | 67 | */ |
77 | 68 | version: { |
... | ... | @@ -114,16 +105,15 @@ Any number of components can use `<google-maps-api>` elements, and the library w |
114 | 105 | /** @private */ |
115 | 106 | libraryUrl: { |
116 | 107 | type: String, |
117 | - computed: '_computeUrl(mapsUrl, version, libraries, apiKey, clientId, language, signedIn)' | |
108 | + computed: '_computeUrl(mapsUrl, version, apiKey, clientId, language, signedIn)' | |
118 | 109 | } |
119 | 110 | }, |
120 | 111 | |
121 | - _computeUrl: function(mapsUrl, version, libraries, apiKey, clientId, language, signedIn) { | |
112 | + _computeUrl: function(mapsUrl, version, apiKey, clientId, language, signedIn) { | |
122 | 113 | var url = mapsUrl + '&v=' + version; |
123 | 114 | |
124 | - if (libraries) { | |
125 | - url += "&libraries=" + libraries; | |
126 | - } | |
115 | + // Always load all Maps API libraries. | |
116 | + url += '&libraries=drawing,geometry,places,visualization'; | |
127 | 117 | |
128 | 118 | if (apiKey && !clientId) { |
129 | 119 | url += '&key=' + apiKey; | ... | ... |
bower_components/google-apis/google-plusone-api.html
100755 → 100644
bower_components/google-apis/google-realtime-api.html
100755 → 100644
bower_components/google-apis/google-youtube-api.html
100755 → 100644
bower_components/google-apis/index.html
100755 → 100644
bower_components/google-map/.bower.json
100755 → 100644
1 | 1 | { |
2 | 2 | "name": "google-map", |
3 | - "version": "1.1.2", | |
3 | + "version": "1.1.4", | |
4 | 4 | "description": "Google Maps web components", |
5 | - "homepage": "https://googlewebcomponents.github.io/google-map", | |
5 | + "homepage": "https://elements.polymer-project.org/elements/google-map", | |
6 | 6 | "main": [ |
7 | 7 | "google-map.html", |
8 | 8 | "google-map-search.html", |
... | ... | @@ -28,19 +28,20 @@ |
28 | 28 | "maps" |
29 | 29 | ], |
30 | 30 | "dependencies": { |
31 | - "polymer": "Polymer/polymer#^1.1.0", | |
32 | - "google-apis": "GoogleWebComponents/google-apis#^1.1.0", | |
33 | - "iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0" | |
31 | + "polymer": "Polymer/polymer#^1.1.4", | |
32 | + "google-apis": "GoogleWebComponents/google-apis#^1.1.1", | |
33 | + "iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0", | |
34 | + "iron-selector": "PolymerElements/iron-selector#^1.0.5" | |
34 | 35 | }, |
35 | 36 | "devDependencies": { |
36 | 37 | "web-component-tester": "*", |
37 | 38 | "iron-component-page": "PolymerElements/iron-component-page#^1.0.2" |
38 | 39 | }, |
39 | - "_release": "1.1.2", | |
40 | + "_release": "1.1.4", | |
40 | 41 | "_resolution": { |
41 | 42 | "type": "version", |
42 | - "tag": "1.1.2", | |
43 | - "commit": "3567129ffac7df683346b5c9d8ad0c32e9213adb" | |
43 | + "tag": "1.1.4", | |
44 | + "commit": "571392000956d93dddd9e2f6d3eb9593a588f5f0" | |
44 | 45 | }, |
45 | 46 | "_source": "git://github.com/GoogleWebComponents/google-map.git", |
46 | 47 | "_target": "^1.0.0", | ... | ... |
bower_components/google-map/LICENSE
100755 → 100644
bower_components/google-map/README.md
100755 → 100644
bower_components/google-map/bower.json
100755 → 100644
1 | 1 | { |
2 | 2 | "name": "google-map", |
3 | - "version": "1.1.2", | |
3 | + "version": "1.1.4", | |
4 | 4 | "description": "Google Maps web components", |
5 | - "homepage": "https://googlewebcomponents.github.io/google-map", | |
5 | + "homepage": "https://elements.polymer-project.org/elements/google-map", | |
6 | 6 | "main": [ |
7 | 7 | "google-map.html", |
8 | 8 | "google-map-search.html", |
... | ... | @@ -28,9 +28,10 @@ |
28 | 28 | "maps" |
29 | 29 | ], |
30 | 30 | "dependencies": { |
31 | - "polymer": "Polymer/polymer#^1.1.0", | |
32 | - "google-apis": "GoogleWebComponents/google-apis#^1.1.0", | |
33 | - "iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0" | |
31 | + "polymer": "Polymer/polymer#^1.1.4", | |
32 | + "google-apis": "GoogleWebComponents/google-apis#^1.1.1", | |
33 | + "iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0", | |
34 | + "iron-selector": "PolymerElements/iron-selector#^1.0.5" | |
34 | 35 | }, |
35 | 36 | "devDependencies": { |
36 | 37 | "web-component-tester": "*", | ... | ... |
bower_components/google-map/demo/index.html
100755 → 100644
... | ... | @@ -4,9 +4,10 @@ |
4 | 4 | <head> |
5 | 5 | <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> |
6 | 6 | <title>Google Map demo</title> |
7 | - <script src="../../webcomponentsjs/webcomponents-lite.js"></script> | |
7 | + <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script> | |
8 | 8 | <link rel="import" href="../google-map.html"> |
9 | 9 | <link rel="import" href="../google-map-marker.html"> |
10 | + <link rel="import" href="../google-map-poly.html"> | |
10 | 11 | <link rel="import" href="../google-map-directions.html"> |
11 | 12 | <style> |
12 | 13 | body { |
... | ... | @@ -22,14 +23,17 @@ |
22 | 23 | </head> |
23 | 24 | <body fullbleed> |
24 | 25 | |
25 | -<!-- Note: places library needs to be loaded because we're using google-map-directions | |
26 | - which also loads the maps lib with the places library. --> | |
27 | 26 | <google-map latitude="37.779" longitude="-122.3892" min-zoom="9" max-zoom="11" |
28 | - language="en" libraries="places"> | |
27 | + language="en"> | |
29 | 28 | <google-map-marker latitude="37.779" longitude="-122.3892" |
30 | 29 | title="Go Giants!" draggable="true"> |
31 | 30 | <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/San_Francisco_Giants_Cap_Insignia.svg/200px-San_Francisco_Giants_Cap_Insignia.svg.png" /> |
32 | 31 | </google-map-marker> |
32 | + <google-map-poly closed fill-color="red" fill-opacity=".25" stroke-weight="1"> | |
33 | + <google-map-point latitude="37.779" longitude="-122.3892"></google-map-point> | |
34 | + <google-map-point latitude="37.804" longitude="-122.2711"></google-map-point> | |
35 | + <google-map-point latitude="37.386" longitude="-122.0837"></google-map-point> | |
36 | + </google-map-poly> | |
33 | 37 | </google-map> |
34 | 38 | |
35 | 39 | <google-map-directions start-address="Oakland" end-address="Mountain View" | ... | ... |
bower_components/google-map/demo/polys.html
0 → 100644
1 | +<!doctype html> | |
2 | +<!-- Copyright (c) 2015 Google Inc. All rights reserved. --> | |
3 | +<html> | |
4 | +<head> | |
5 | + <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | |
6 | + <title>Google Map Poly demo</title> | |
7 | + <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script> | |
8 | + <link rel="import" href="../google-map.html"> | |
9 | + <link rel="import" href="../google-map-poly.html"> | |
10 | + <style> | |
11 | + body { | |
12 | + margin: 0; | |
13 | + height: 100vh; | |
14 | + } | |
15 | + #toggleEdit { | |
16 | + position: absolute; | |
17 | + top: 10px; | |
18 | + left: 120px; | |
19 | + } | |
20 | + </style> | |
21 | +</head> | |
22 | +<body fullbleed> | |
23 | + | |
24 | +<google-map latitude="37.779" longitude="-122.3892" min-zoom="9" max-zoom="11" language="en"> | |
25 | + <google-map-poly closed fill-color="red" fill-opacity=".25" stroke-weight="1"> | |
26 | + <google-map-point latitude="37.779" longitude="-122.3892"></google-map-point> | |
27 | + <google-map-point latitude="37.804" longitude="-122.2711"></google-map-point> | |
28 | + <google-map-point latitude="37.386" longitude="-122.0837"></google-map-point> | |
29 | + </google-map-poly> | |
30 | +</google-map> | |
31 | + | |
32 | +<button id="toggleEdit" onclick="toggleEdit()">Enable editing</button> | |
33 | + | |
34 | +<script> | |
35 | + var poly = document.querySelector('google-map-poly'); | |
36 | + var button = document.querySelector('#toggleEdit'); | |
37 | + | |
38 | + function toggleEdit() { | |
39 | + poly.editable = !poly.editable; | |
40 | + button.innerText = poly.editable ? 'Disable editing' : 'Enable editing'; | |
41 | + } | |
42 | +</script> | |
43 | +</body> | |
44 | +</html> | ... | ... |
bower_components/google-map/google-map-directions.html
100755 → 100644
... | ... | @@ -33,7 +33,6 @@ information on the API. |
33 | 33 | <template> |
34 | 34 | <google-maps-api |
35 | 35 | api-key="[[apiKey]]" |
36 | - libraries="[[libraries]]" | |
37 | 36 | language="[[language]]" |
38 | 37 | on-api-load="_mapApiLoaded"></google-maps-api> |
39 | 38 | </template> |
... | ... | @@ -48,8 +47,7 @@ information on the API. |
48 | 47 | Fired whenever the directions service returns a result. |
49 | 48 | |
50 | 49 | @event google-map-response |
51 | -@param {Object} detail | |
52 | -@param {object} detail.response The directions service response. | |
50 | +@param {{response: Object}}} detail | |
53 | 51 | */ |
54 | 52 | properties: { |
55 | 53 | /** |
... | ... | @@ -110,20 +108,6 @@ Fired whenever the directions service returns a result. |
110 | 108 | }, |
111 | 109 | |
112 | 110 | /** |
113 | - * A comma separated list (e.g. "places,geometry") of libraries to load | |
114 | - * with this map. Defaults to "places". For more information see | |
115 | - * https://developers.google.com/maps/documentation/javascript/libraries. | |
116 | - * | |
117 | - * Note, this needs to be set to the same value as the one used on <google-map>. | |
118 | - * If you're overriding that element's `libraries` property, this one also | |
119 | - * needs to be set to the Maps API loads the library code. | |
120 | - */ | |
121 | - libraries: { | |
122 | - type: String, | |
123 | - value: 'places' | |
124 | - }, | |
125 | - | |
126 | - /** | |
127 | 111 | * The localized language to load the Maps API with. For more information |
128 | 112 | * see https://developers.google.com/maps/documentation/javascript/basics#Language |
129 | 113 | * |
... | ... | @@ -136,6 +120,14 @@ Fired whenever the directions service returns a result. |
136 | 120 | }, |
137 | 121 | |
138 | 122 | /** |
123 | + * Options for the display of results | |
124 | + */ | |
125 | + rendererOptions: { | |
126 | + type: Object, | |
127 | + value: function() { return {}; } | |
128 | + }, | |
129 | + | |
130 | + /** | |
139 | 131 | * The response from the directions service. |
140 | 132 | * |
141 | 133 | */ |
... | ... | @@ -163,7 +155,7 @@ Fired whenever the directions service returns a result. |
163 | 155 | _mapChanged: function() { |
164 | 156 | if (this.map && this.map instanceof google.maps.Map) { |
165 | 157 | if (!this.directionsRenderer) { |
166 | - this.directionsRenderer = new google.maps.DirectionsRenderer(); | |
158 | + this.directionsRenderer = new google.maps.DirectionsRenderer(this.rendererOptions); | |
167 | 159 | } |
168 | 160 | this.directionsRenderer.setMap(this.map); |
169 | 161 | this._responseChanged(); | ... | ... |
bower_components/google-map/google-map-marker.html
100755 → 100644
... | ... | @@ -115,6 +115,16 @@ child of `google-map`. |
115 | 115 | * @param {google.maps.MouseEvent} event The mouse event. |
116 | 116 | */ |
117 | 117 | |
118 | + /** | |
119 | + * Fired when an infowindow is opened. | |
120 | + * @event google-map-marker-open | |
121 | + */ | |
122 | + | |
123 | + /** | |
124 | + * Fired when the close button of the infowindow is pressed. | |
125 | + * @event google-map-marker-close | |
126 | + */ | |
127 | + | |
118 | 128 | properties: { |
119 | 129 | /** |
120 | 130 | * A Google Maps marker object. |
... | ... | @@ -202,6 +212,15 @@ child of `google-map`. |
202 | 212 | type: String, |
203 | 213 | value: null, |
204 | 214 | observer: '_animationChanged' |
215 | + }, | |
216 | + | |
217 | + /** | |
218 | + * Specifies whether the InfoWindow is open or not | |
219 | + */ | |
220 | + open: { | |
221 | + type: Boolean, | |
222 | + value: false, | |
223 | + observer: '_openChanged' | |
205 | 224 | } |
206 | 225 | }, |
207 | 226 | |
... | ... | @@ -310,20 +329,37 @@ child of `google-map`. |
310 | 329 | if (!this.info) { |
311 | 330 | // Create a new infowindow |
312 | 331 | this.info = new google.maps.InfoWindow(); |
313 | - this.infoHandler_ = google.maps.event.addListener(this.marker, 'click', function() { | |
314 | - this.info.open(this.map, this.marker); | |
332 | + this.openInfoHandler_ = google.maps.event.addListener(this.marker, 'click', function() { | |
333 | + this.open = true; | |
334 | + }.bind(this)); | |
335 | + | |
336 | + this.closeInfoHandler_ = google.maps.event.addListener(this.info, 'closeclick', function() { | |
337 | + this.open = false; | |
315 | 338 | }.bind(this)); |
316 | 339 | } |
317 | 340 | this.info.setContent(content); |
318 | 341 | } else { |
319 | 342 | if (this.info) { |
320 | 343 | // Destroy the existing infowindow. It doesn't make sense to have an empty one. |
321 | - google.maps.event.removeListener(this.infoHandler_); | |
344 | + google.maps.event.removeListener(this.openInfoHandler_); | |
345 | + google.maps.event.removeListener(this.closeInfoHandler_); | |
322 | 346 | this.info = null; |
323 | 347 | } |
324 | 348 | } |
325 | 349 | }, |
326 | 350 | |
351 | + _openChanged: function() { | |
352 | + if (this.info) { | |
353 | + if (this.open) { | |
354 | + this.info.open(this.map, this.marker); | |
355 | + this.fire('google-map-marker-open'); | |
356 | + } else { | |
357 | + this.info.close(); | |
358 | + this.fire('google-map-marker-close'); | |
359 | + } | |
360 | + } | |
361 | + }, | |
362 | + | |
327 | 363 | _mapReady: function() { |
328 | 364 | this._listeners = {}; |
329 | 365 | this.marker = new google.maps.Marker({ |
... | ... | @@ -343,6 +379,7 @@ child of `google-map`. |
343 | 379 | this._clickEventsChanged(); |
344 | 380 | this._contentChanged(); |
345 | 381 | this._mouseEventsChanged(); |
382 | + this._openChanged(); | |
346 | 383 | setupDragHandler_.bind(this)(); |
347 | 384 | }, |
348 | 385 | ... | ... |
bower_components/google-map/google-map-point.html
0 → 100644
1 | +<!-- Copyright (c) 2015 Google Inc. All rights reserved. --> | |
2 | + | |
3 | +<link rel="import" href="../polymer/polymer.html"> | |
4 | +<link rel="import" href="../google-apis/google-maps-api.html"> | |
5 | + | |
6 | +<!-- | |
7 | +The `google-map-point` element represents a point on a map. It's used as a child of other | |
8 | +google-map-* elements. | |
9 | + | |
10 | +<b>Example</b>—points defining a semi-translucent blue triangle: | |
11 | + | |
12 | + <google-map latitude="37.77493" longitude="-122.41942"> | |
13 | + <google-map-poly closed fill-color="blue" fill-opacity=".5"> | |
14 | + <google-map-point latitude="36.77493" longitude="-121.41942"></google-map-point> | |
15 | + <google-map-point latitude="38.77493" longitude="-122.41942"></google-map-point> | |
16 | + <google-map-point latitude="36.77493" longitude="-123.41942"></google-map-point> | |
17 | + </google-map-poly> | |
18 | + </google-map> | |
19 | +--> | |
20 | +<script> | |
21 | + Polymer({ | |
22 | + is: 'google-map-point', | |
23 | + | |
24 | + hostAttributes: {hidden: true}, | |
25 | + | |
26 | + properties: { | |
27 | + /** | |
28 | + * The point's longitude coordinate. | |
29 | + */ | |
30 | + longitude: { | |
31 | + type: Number, | |
32 | + value: null | |
33 | + }, | |
34 | + | |
35 | + /** | |
36 | + * The point's latitude coordinate. | |
37 | + */ | |
38 | + latitude: { | |
39 | + type: Number, | |
40 | + value: null | |
41 | + } | |
42 | + }, | |
43 | + | |
44 | + /** | |
45 | + * Returns the point as a Google Maps LatLng object. | |
46 | + * | |
47 | + * @return {google.maps.LatLnt} The LatLng object. | |
48 | + */ | |
49 | + getPosition: function() { | |
50 | + return new google.maps.LatLng(this.latitude, this.longitude); | |
51 | + } | |
52 | + }); | |
53 | +</script> | ... | ... |
bower_components/google-map/google-map-poly.html
0 → 100644
1 | +<!-- Copyright (c) 2015 Google Inc. All rights reserved. --> | |
2 | + | |
3 | +<link rel="import" href="../polymer/polymer.html"> | |
4 | +<link rel="import" href="../google-apis/google-maps-api.html"> | |
5 | +<link rel="import" href="google-map-point.html"> | |
6 | + | |
7 | +<!-- | |
8 | +The `google-map-poly` element represents a series of connected line segments (aka a polyline) which | |
9 | +may also be closed to form a polygon (provided there are at least three points). It is used as a | |
10 | +child of `google-map` and will contain at least two `google-map-point` child elements. | |
11 | + | |
12 | +<b>Example</b>—a simple line: | |
13 | + | |
14 | + <google-map latitude="37.77493" longitude="-122.41942"> | |
15 | + <google-map-poly> | |
16 | + <google-map-point latitude="37.77493" longitude="-122.41942"></google-map-point> | |
17 | + <google-map-point latitude="38.77493" longitude="-123.41942"></google-map-point> | |
18 | + </google-map-poly> | |
19 | + </google-map> | |
20 | + | |
21 | +<b>Example</b>—a semi-translucent blue triangle: | |
22 | + | |
23 | + <google-map latitude="37.77493" longitude="-122.41942"> | |
24 | + <google-map-poly closed fill-color="blue" fill-opacity=".5"> | |
25 | + <google-map-point latitude="36.77493" longitude="-121.41942"></google-map-point> | |
26 | + <google-map-point latitude="38.77493" longitude="-122.41942"></google-map-point> | |
27 | + <google-map-point latitude="36.77493" longitude="-123.41942"></google-map-point> | |
28 | + </google-map-poly> | |
29 | + </google-map> | |
30 | +--> | |
31 | + | |
32 | +<dom-module id="google-map-poly"> | |
33 | + <style> | |
34 | + :host { | |
35 | + display: none; | |
36 | + } | |
37 | + </style> | |
38 | + <template> | |
39 | + <content id="points" select="google-map-point"></content> | |
40 | + </template> | |
41 | +</polymer-element> | |
42 | + | |
43 | +<script> | |
44 | + Polymer({ | |
45 | + is: 'google-map-poly', | |
46 | + | |
47 | + /** | |
48 | + * Fired when the `path` property is built based on child `google-map-point` elements, either | |
49 | + * initially or when they are changed. | |
50 | + * @event google-map-poly-path-built | |
51 | + * @param {MVCArray.<LatLng>} path The poly path. | |
52 | + */ | |
53 | + /** | |
54 | + * Fired when the user finishes adding vertices to the poly. The host component can use the | |
55 | + * provided path to rebuild its list of points. | |
56 | + * @event google-map-poly-path-updated | |
57 | + * @param {MVCArray.<LatLng>} path The poly path. | |
58 | + */ | |
59 | + /** | |
60 | + * Fired when the DOM `click` event is fired on the poly. Requires the clickEvents attribute to | |
61 | + * be true. | |
62 | + * @event google-map-poly-click | |
63 | + * @param {google.maps.PolyMouseEvent} event The poly event. | |
64 | + */ | |
65 | + /** | |
66 | + * Fired when the DOM `dblclick` event is fired on the poly. Requires the clickEvents attribute | |
67 | + * to be true. | |
68 | + * @event google-map-poly-dblclick | |
69 | + * @param {google.maps.PolyMouseEvent} event The poly event. | |
70 | + */ | |
71 | + /** | |
72 | + * Fired repeatedly while the user drags the poly. Requires the dragEvents attribute to be true. | |
73 | + * @event google-map-poly-drag | |
74 | + * @param {google.maps.MouseEvent} event The mouse event. | |
75 | + */ | |
76 | + /** | |
77 | + * Fired when the user stops dragging the poly. Requires the dragEvents attribute to be true. | |
78 | + * @event google-map-poly-dragend | |
79 | + * @param {google.maps.MouseEvent} event The mouse event. | |
80 | + */ | |
81 | + /** | |
82 | + * Fired when the user starts dragging the poly. Requires the dragEvents attribute to be true. | |
83 | + * @event google-map-poly-dragstart | |
84 | + * @param {google.maps.MouseEvent} event The mouse event. | |
85 | + */ | |
86 | + /** | |
87 | + * Fired when the DOM `mousedown` event is fired on the poly. Requires the mouseEvents attribute | |
88 | + * to be true. | |
89 | + * @event google-map-poly-mousedown | |
90 | + * @param {google.maps.PolyMouseEvent} event The poly event. | |
91 | + */ | |
92 | + /** | |
93 | + * Fired when the DOM `mousemove` event is fired on the poly. Requires the mouseEvents attribute | |
94 | + * to be true. | |
95 | + * @event google-map-poly-mousemove | |
96 | + * @param {google.maps.PolyMouseEvent} event The poly event. | |
97 | + */ | |
98 | + /** | |
99 | + * Fired on poly mouseout. Requires the mouseEvents attribute to be true. | |
100 | + * @event google-map-poly-mouseout | |
101 | + * @param {google.maps.PolyMouseEvent} event The poly event. | |
102 | + */ | |
103 | + /** | |
104 | + * Fired on poly mouseover. Requires the mouseEvents attribute to be true. | |
105 | + * @event google-map-poly-mouseover | |
106 | + * @param {google.maps.PolyMouseEvent} event The poly event. | |
107 | + */ | |
108 | + /** | |
109 | + * Fired when the DOM `mouseup` event is fired on the poly. Requires the mouseEvents attribute | |
110 | + * to be true. | |
111 | + * @event google-map-poly-mouseup | |
112 | + * @param {google.maps.PolyMouseEvent} event The poly event. | |
113 | + */ | |
114 | + /** | |
115 | + * Fired when the poly is right-clicked on. Requires the clickEvents attribute to be true. | |
116 | + * @event google-map-poly-rightclick | |
117 | + * @param {google.maps.PolyMouseEvent} event The poly event. | |
118 | + */ | |
119 | + properties: { | |
120 | + /** | |
121 | + * A Google Maps polyline or polygon object (depending on value of "closed" attribute). | |
122 | + * @type google.maps.Polyline|google.maps.Polygon | |
123 | + */ | |
124 | + poly: { | |
125 | + type: Object, | |
126 | + readOnly: true | |
127 | + }, | |
128 | + | |
129 | + /** | |
130 | + * An array of the Google Maps LatLng objects that define the poly shape. | |
131 | + * @type MVCArray.<LatLng> | |
132 | + */ | |
133 | + path: { | |
134 | + type: Object, | |
135 | + readOnly: true | |
136 | + }, | |
137 | + | |
138 | + /** | |
139 | + * The Google map object. | |
140 | + * @type google.maps.Map | |
141 | + */ | |
142 | + map: { | |
143 | + type: Object, | |
144 | + observer: '_mapChanged' | |
145 | + }, | |
146 | + | |
147 | + /** | |
148 | + * When true, the poly will generate mouse events. | |
149 | + */ | |
150 | + clickable: { | |
151 | + type: Boolean, | |
152 | + value: false, | |
153 | + observer: '_clickableChanged' | |
154 | + }, | |
155 | + | |
156 | + /** | |
157 | + * When true, the google-map-poly-*click events will be automatically registered. | |
158 | + */ | |
159 | + clickEvents: { | |
160 | + type: Boolean, | |
161 | + value: false, | |
162 | + observer: '_clickEventsChanged' | |
163 | + }, | |
164 | + | |
165 | + /** | |
166 | + * When true, the path will be closed by connecting the last point to the first one and | |
167 | + * treating the poly as a polygon. | |
168 | + */ | |
169 | + closed: { | |
170 | + type: Boolean, | |
171 | + value: false, | |
172 | + observer: '_closedChanged' | |
173 | + }, | |
174 | + | |
175 | + /** | |
176 | + * When true, the poly may be dragged to a new position. | |
177 | + */ | |
178 | + draggable: { | |
179 | + type: Boolean, | |
180 | + value: false, | |
181 | + }, | |
182 | + | |
183 | + /** | |
184 | + * When true, the google-map-poly-drag* events will be automatically registered. | |
185 | + */ | |
186 | + dragEvents: { | |
187 | + type: Boolean, | |
188 | + value: false, | |
189 | + observer: '_dragEventsChanged' | |
190 | + }, | |
191 | + | |
192 | + /** | |
193 | + * When true, the poly's vertices may be individually moved or new ones added. | |
194 | + */ | |
195 | + editable: { | |
196 | + type: Boolean, | |
197 | + value: false, | |
198 | + observer: '_editableChanged' | |
199 | + }, | |
200 | + | |
201 | + /** | |
202 | + * When true, indicates that the user has begun editing the poly path (adding vertices). | |
203 | + */ | |
204 | + editing: { | |
205 | + type: Boolean, | |
206 | + value: false, | |
207 | + notify: true, | |
208 | + readOnly: true | |
209 | + }, | |
210 | + | |
211 | + /** | |
212 | + * If the path is closed, the polygon fill color. All CSS3 colors are supported except for | |
213 | + * extended named colors. | |
214 | + */ | |
215 | + fillColor: { | |
216 | + type: String, | |
217 | + value: '', | |
218 | + observer: '_fillColorChanged' | |
219 | + }, | |
220 | + | |
221 | + /** | |
222 | + * If the path is closed, the polygon fill opacity (between 0.0 and 1.0). | |
223 | + */ | |
224 | + fillOpacity: { | |
225 | + type: Number, | |
226 | + value: 0, | |
227 | + observer: '_fillOpacityChanged' | |
228 | + }, | |
229 | + | |
230 | + /** | |
231 | + * When true, the poly's edges are interpreted as geodesic and will follow the curvature of | |
232 | + * the Earth. When not set, the poly's edges are rendered as straight lines in screen space. | |
233 | + * Note that the poly of a geodesic poly may appear to change when dragged, as the dimensions | |
234 | + * are maintained relative to the surface of the earth. | |
235 | + */ | |
236 | + geodesic: { | |
237 | + type: Boolean, | |
238 | + value: false, | |
239 | + observer: '_geodesicChanged' | |
240 | + }, | |
241 | + | |
242 | + /** | |
243 | + * If the path is not closed, the icons to be rendered along the polyline. | |
244 | + */ | |
245 | + icons: { | |
246 | + type: Array, | |
247 | + value: null, | |
248 | + observer: '_iconsChanged' | |
249 | + }, | |
250 | + | |
251 | + /** | |
252 | + * When true, the google-map-poly-mouse* events will be automatically registered. | |
253 | + */ | |
254 | + mouseEvents: { | |
255 | + type: Boolean, | |
256 | + value: false, | |
257 | + observer: '_mouseEventsChanged' | |
258 | + }, | |
259 | + | |
260 | + /** | |
261 | + * The color to draw the poly's stroke with. All CSS3 colors are supported except for extended | |
262 | + * named colors. | |
263 | + */ | |
264 | + strokeColor: { | |
265 | + type: String, | |
266 | + value: 'black', | |
267 | + observer: '_strokeColorChanged' | |
268 | + }, | |
269 | + | |
270 | + /** | |
271 | + * The stroke opacity (between 0.0 and 1.0). | |
272 | + */ | |
273 | + strokeOpacity: { | |
274 | + type: Number, | |
275 | + value: 1, | |
276 | + observer: '_strokeOpacityChanged' | |
277 | + }, | |
278 | + | |
279 | + /** | |
280 | + * The stroke position (center, inside, or outside). | |
281 | + */ | |
282 | + strokePosition: { | |
283 | + type: String, | |
284 | + value: 'center', | |
285 | + observer: '_strokePositionChanged' | |
286 | + }, | |
287 | + | |
288 | + /** | |
289 | + * The stroke width in pixels. | |
290 | + */ | |
291 | + strokeWeight: { | |
292 | + type: Number, | |
293 | + value: 3, | |
294 | + observer: '_strokeWeightChanged' | |
295 | + }, | |
296 | + | |
297 | + /** | |
298 | + * The Z-index relative to other objects on the map. | |
299 | + */ | |
300 | + zIndex: { | |
301 | + type: Number, | |
302 | + value: 0, | |
303 | + observer: '_zIndexChanged' | |
304 | + } | |
305 | + }, | |
306 | + | |
307 | + // Lifecycle event handlers. | |
308 | + | |
309 | + detached: function() { | |
310 | + this.poly.setMap(null); | |
311 | + if (this._pointsObserver) { | |
312 | + this._pointsObserver.disconnect(); | |
313 | + this._pointsObserver = null; | |
314 | + } | |
315 | + for (var name in this._listeners) { | |
316 | + this._clearListener(name); | |
317 | + } | |
318 | + }, | |
319 | + | |
320 | + attached: function() { | |
321 | + // If element is added back to DOM, put it back on the map. | |
322 | + this.poly && this.poly.setMap(this.map); | |
323 | + }, | |
324 | + | |
325 | + // Attribute/property change watchers. | |
326 | + | |
327 | + attributeChanged: function(attrName, oldVal, newVal) { | |
328 | + if (!this.poly) { | |
329 | + return; | |
330 | + } | |
331 | + | |
332 | + // Cannot use *Changed watchers for native properties. | |
333 | + switch (attrName) { | |
334 | + case 'hidden': | |
335 | + this.poly.setVisible(!this.hidden); | |
336 | + break; | |
337 | + case 'draggable': | |
338 | + this.poly.setDraggable(this.draggable); | |
339 | + break; | |
340 | + } | |
341 | + }, | |
342 | + | |
343 | + _clickableChanged: function() { | |
344 | + this.poly && this.poly.set('clickable', this.clickable); | |
345 | + }, | |
346 | + | |
347 | + _clickEventsChanged: function() { | |
348 | + if (this.poly) { | |
349 | + if (this.clickEvents) { | |
350 | + this._forwardEvent('click'); | |
351 | + this._forwardEvent('dblclick'); | |
352 | + this._forwardEvent('rightclick'); | |
353 | + } else { | |
354 | + this._clearListener('click'); | |
355 | + this._clearListener('dblclick'); | |
356 | + this._clearListener('rightclick'); | |
357 | + } | |
358 | + } | |
359 | + }, | |
360 | + | |
361 | + _closedChanged: function() { | |
362 | + this._mapChanged(); | |
363 | + }, | |
364 | + | |
365 | + _dragEventsChanged: function() { | |
366 | + if (this.poly) { | |
367 | + if (this.clickEvents) { | |
368 | + this._forwardEvent('drag'); | |
369 | + this._forwardEvent('dragend'); | |
370 | + this._forwardEvent('dragstart'); | |
371 | + } else { | |
372 | + this._clearListener('drag'); | |
373 | + this._clearListener('dragend'); | |
374 | + this._clearListener('dragstart'); | |
375 | + } | |
376 | + } | |
377 | + }, | |
378 | + | |
379 | + _editableChanged: function() { | |
380 | + this.poly && this.poly.setEditable(this.editable); | |
381 | + }, | |
382 | + | |
383 | + _fillColorChanged: function() { | |
384 | + this.poly && this.poly.set('fillColor', this.fillColor); | |
385 | + }, | |
386 | + | |
387 | + _fillOpacityChanged: function() { | |
388 | + this.poly && this.poly.set('fillOpacity', this.fillOpacity); | |
389 | + }, | |
390 | + | |
391 | + _geodesicChanged: function() { | |
392 | + this.poly && this.poly.set('geodesic', this.geodesic); | |
393 | + }, | |
394 | + | |
395 | + _iconsChanged: function() { | |
396 | + this.poly && this.poly.set('icons', this.icons); | |
397 | + }, | |
398 | + | |
399 | + _mapChanged: function() { | |
400 | + // Poly will be rebuilt, so disconnect existing one from old map and listeners. | |
401 | + if (this.poly) { | |
402 | + this.poly.setMap(null); | |
403 | + google.maps.event.clearInstanceListeners(this.poly); | |
404 | + } | |
405 | + | |
406 | + if (this.map && this.map instanceof google.maps.Map) { | |
407 | + this._createPoly(); | |
408 | + } | |
409 | + }, | |
410 | + | |
411 | + _mouseEventsChanged: function() { | |
412 | + if (this.poly) { | |
413 | + if (this.mouseEvents) { | |
414 | + this._forwardEvent('mousedown'); | |
415 | + this._forwardEvent('mousemove'); | |
416 | + this._forwardEvent('mouseout'); | |
417 | + this._forwardEvent('mouseover'); | |
418 | + this._forwardEvent('mouseup'); | |
419 | + } else { | |
420 | + this._clearListener('mousedown'); | |
421 | + this._clearListener('mousemove'); | |
422 | + this._clearListener('mouseout'); | |
423 | + this._clearListener('mouseover'); | |
424 | + this._clearListener('mouseup'); | |
425 | + } | |
426 | + } | |
427 | + }, | |
428 | + | |
429 | + _strokeColorChanged: function() { | |
430 | + this.poly && this.poly.set('strokeColor', this.strokeColor); | |
431 | + }, | |
432 | + | |
433 | + _strokeOpacityChanged: function() { | |
434 | + this.poly && this.poly.set('strokeOpacity', this.strokeOpacity); | |
435 | + }, | |
436 | + | |
437 | + _strokePositionChanged: function() { | |
438 | + this.poly && this.poly.set('strokePosition', this._convertStrokePosition()); | |
439 | + }, | |
440 | + | |
441 | + _strokeWeightChanged: function() { | |
442 | + this.poly && this.poly.set('strokeWeight', this.strokeWeight); | |
443 | + }, | |
444 | + | |
445 | + _zIndexChanged: function() { | |
446 | + this.poly && this.poly.set('zIndex', this.zIndex); | |
447 | + }, | |
448 | + | |
449 | + // Helper logic. | |
450 | + | |
451 | + _buildPathFromPoints: function() { | |
452 | + this._points = Array.prototype.slice.call(Polymer.dom(this.$.points).getDistributedNodes()); | |
453 | + | |
454 | + // Build path from current points (ignoring vertex insertions while doing so). | |
455 | + this._building = true; | |
456 | + this.path.clear(); | |
457 | + for (var i = 0, point; point = this._points[i]; ++i) { | |
458 | + this.path.push(point.getPosition()); | |
459 | + } | |
460 | + this._building = false; | |
461 | + | |
462 | + this.fire('google-map-poly-path-built', this.path); | |
463 | + | |
464 | + // Watch for future updates. | |
465 | + if (this._pointsObserver) { | |
466 | + return; | |
467 | + } | |
468 | + this._pointsObserver = new MutationObserver(this._buildPathFromPoints.bind(this)); | |
469 | + this._pointsObserver.observe(this, { | |
470 | + childList: true | |
471 | + }); | |
472 | + }, | |
473 | + | |
474 | + _clearListener: function(name) { | |
475 | + if (this._listeners[name]) { | |
476 | + google.maps.event.removeListener(this._listeners[name]); | |
477 | + this._listeners[name] = null; | |
478 | + } | |
479 | + }, | |
480 | + | |
481 | + _convertStrokePosition: function() { | |
482 | + return google.maps.StrokePosition && this.strokePosition ? | |
483 | + google.maps.StrokePosition[this.strokePosition.toUpperCase()] : 0; | |
484 | + }, | |
485 | + | |
486 | + _createPoly: function() { | |
487 | + // Build poly's path and register mutation listeners on first creation. | |
488 | + if (!this.path) { | |
489 | + this._setPath(new google.maps.MVCArray()); | |
490 | + google.maps.event.addListener(this.path, 'insert_at', this._startEditing.bind(this)); | |
491 | + google.maps.event.addListener(this.path, 'set_at', this._updatePoint.bind(this)); | |
492 | + this._buildPathFromPoints(); | |
493 | + } | |
494 | + | |
495 | + var options = { | |
496 | + clickable: this.clickable || this.draggable, // draggable must be clickable to work. | |
497 | + draggable: this.draggable, | |
498 | + editable: this.editable, | |
499 | + geodesic: this.geodesic, | |
500 | + map: this.map, | |
501 | + path: this.path, | |
502 | + strokeColor: this.strokeColor, | |
503 | + strokeOpacity: this.strokeOpacity, | |
504 | + strokePosition: this._convertStrokePosition(), | |
505 | + strokeWeight: this.strokeWeight, | |
506 | + visible: !this.hidden, | |
507 | + zIndex: this.zIndex | |
508 | + }; | |
509 | + | |
510 | + if (this.closed) { | |
511 | + options.fillColor = this.fillColor; | |
512 | + options.fillOpacity = this.fillOpacity; | |
513 | + this._setPoly(new google.maps.Polygon(options)); | |
514 | + } else { | |
515 | + options.icons = this.icons; | |
516 | + this._setPoly(new google.maps.Polyline(options)); | |
517 | + } | |
518 | + | |
519 | + this._listeners = {}; | |
520 | + }, | |
521 | + | |
522 | + _forwardEvent: function(name) { | |
523 | + this._listeners[name] = google.maps.event.addListener(this.poly, name, function(event) { | |
524 | + this.fire('google-map-poly-' + name, event); | |
525 | + }.bind(this)); | |
526 | + }, | |
527 | + | |
528 | + _startEditing: function(index) { | |
529 | + if (this._building) { | |
530 | + // Ignore changes while building path. | |
531 | + return; | |
532 | + } | |
533 | + | |
534 | + // Signal start of editing when first vertex inserted, end when map clicked. | |
535 | + if (!this.editing) { | |
536 | + this._setEditing(true); | |
537 | + // The poly path and google-map-point elements lose sync once the user starts adding points, | |
538 | + // so invalidate the _points array. | |
539 | + this._points = null; | |
540 | + google.maps.event.addListenerOnce(this.map, 'click', function() { | |
541 | + this._setEditing(false); | |
542 | + this.fire('google-map-poly-path-updated', this.path); | |
543 | + }.bind(this)); | |
544 | + } | |
545 | + }, | |
546 | + | |
547 | + _updatePoint: function(index, vertex) { | |
548 | + // Ignore changes if path is out of sync with google-map-point elements. | |
549 | + if (!this._points) { | |
550 | + return; | |
551 | + } | |
552 | + | |
553 | + // Update existing point so bound properties are updated. too. | |
554 | + this._points[index].latitude = vertex.lat(); | |
555 | + this._points[index].longitude = vertex.lng(); | |
556 | + } | |
557 | + }); | |
558 | +</script> | ... | ... |
bower_components/google-map/google-map-search.html
100755 → 100644
... | ... | @@ -11,8 +11,8 @@ information on the API. |
11 | 11 | #### Example: |
12 | 12 | |
13 | 13 | <template is="dom-bind"> |
14 | - <google-map-search map="[[map]]" libraries="places" query="Pizza" | |
15 | - results="{{results}}"></google-map-search> | |
14 | + <google-map-search map="[[map]]" query="Pizza" results="{{results}}"> | |
15 | + </google-map-search> | |
16 | 16 | <google-map map="{{map}}" latitude="37.779" |
17 | 17 | longitude="-122.3892"> |
18 | 18 | <template is="dom-repeat" items="{{results}}" as="marker"> |
... | ... | @@ -132,17 +132,14 @@ information on the API. |
132 | 132 | * Fired when the details of a place are returned. |
133 | 133 | * |
134 | 134 | * @event google-map-search-place-detail |
135 | - * @param {google.maps.MarkerPlace} detail The place details. | |
135 | + * @param {google.maps.MarkerPlace} detail The place details. | |
136 | 136 | */ |
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Fired when the search element returns a result. |
140 | 140 | * |
141 | 141 | * @event google-map-search-results |
142 | - * @param {Array} detail An array of search results | |
143 | - * @param {number} detail.latitude Latitude of the result. | |
144 | - * @param {number} detail.longitude Longitude of the result. | |
145 | - * @param {bool} detail.show Whether to show the result on the map. | |
142 | + * @param {Array<{latitude: number, longitude: number}>} detail An array of search results | |
146 | 143 | */ |
147 | 144 | |
148 | 145 | /** | ... | ... |
bower_components/google-map/google-map.html
100755 → 100644
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | <link rel="import" href="../polymer/polymer.html"> |
4 | 4 | <link rel="import" href="../google-apis/google-maps-api.html"> |
5 | 5 | <link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html"> |
6 | +<link rel="import" href="../iron-selector/iron-selector.html"> | |
6 | 7 | <link rel="import" href="google-map-marker.html"> |
7 | 8 | <!-- |
8 | 9 | The `google-map` element renders a Google Map. |
... | ... | @@ -38,7 +39,7 @@ The `google-map` element renders a Google Map. |
38 | 39 | |
39 | 40 | <b>Example</b> - with Google directions, using data-binding inside another Polymer element |
40 | 41 | |
41 | - <google-map map="{{map}}" libraries="places"></google-map> | |
42 | + <google-map map="{{map}}"></google-map> | |
42 | 43 | <google-map-directions map="{{map}}" |
43 | 44 | start-address="San Francisco" end-address="Mountain View"> |
44 | 45 | </google-map-directions> |
... | ... | @@ -69,15 +70,16 @@ The `google-map` element renders a Google Map. |
69 | 70 | api-key="[[apiKey]]" |
70 | 71 | client-id="[[clientId]]" |
71 | 72 | version="[[version]]" |
72 | - libraries="[[libraries]]" | |
73 | 73 | signed-in="[[signedIn]]" |
74 | 74 | language="[[language]]" |
75 | 75 | on-api-load="_mapApiLoaded"></google-maps-api> |
76 | 76 | |
77 | 77 | <div id="map"></div> |
78 | 78 | |
79 | - <content id="markers" select="google-map-marker"></content> | |
80 | - | |
79 | + <iron-selector id="selector" multi="[[!singleInfoWindow]]" selected-attribute="open" activate-event="google-map-marker-open" on-google-map-marker-close="_deselectMarker"> | |
80 | + <content id="markers" select="google-map-marker"></content> | |
81 | + </iron-selector> | |
82 | + <content id="objects" select="*"></content> | |
81 | 83 | </template> |
82 | 84 | </dom-module> |
83 | 85 | |
... | ... | @@ -170,16 +172,6 @@ The `google-map` element renders a Google Map. |
170 | 172 | }, |
171 | 173 | |
172 | 174 | /** |
173 | - * A comma separated list (e.g. "places,geometry") of libraries to load | |
174 | - * with this map. Defaults to "". For more information see | |
175 | - * https://developers.google.com/maps/documentation/javascript/libraries. | |
176 | - */ | |
177 | - libraries: { | |
178 | - type: String, | |
179 | - value: '' | |
180 | - }, | |
181 | - | |
182 | - /** | |
183 | 175 | * A longitude to center the map on. |
184 | 176 | */ |
185 | 177 | longitude: { |
... | ... | @@ -351,8 +343,24 @@ The `google-map` element renders a Google Map. |
351 | 343 | type: Array, |
352 | 344 | value: function() { return []; }, |
353 | 345 | readOnly: true |
354 | - } | |
346 | + }, | |
347 | + | |
348 | + /** | |
349 | + * The non-marker objects on the map. | |
350 | + */ | |
351 | + objects: { | |
352 | + type: Array, | |
353 | + value: function() { return []; }, | |
354 | + readOnly: true | |
355 | + }, | |
355 | 356 | |
357 | + /** | |
358 | + * If set, all other info windows on markers are closed when opening a new one. | |
359 | + */ | |
360 | + singleInfoWindow: { | |
361 | + type: Boolean, | |
362 | + value: false | |
363 | + } | |
356 | 364 | }, |
357 | 365 | |
358 | 366 | behaviors: [ |
... | ... | @@ -376,6 +384,10 @@ The `google-map` element renders a Google Map. |
376 | 384 | this._mutationObserver.disconnect(); |
377 | 385 | this._mutationObserver = null; |
378 | 386 | } |
387 | + if (this._objectsMutationObserver) { | |
388 | + this._objectsMutationObserver.disconnect(); | |
389 | + this._objectsMutationObserver = null; | |
390 | + } | |
379 | 391 | }, |
380 | 392 | |
381 | 393 | _initGMap: function() { |
... | ... | @@ -394,6 +406,7 @@ The `google-map` element renders a Google Map. |
394 | 406 | this._updateCenter(); |
395 | 407 | this._loadKml(); |
396 | 408 | this._updateMarkers(); |
409 | + this._updateObjects(); | |
397 | 410 | this._addMapListeners(); |
398 | 411 | this.fire('google-map-ready'); |
399 | 412 | }, |
... | ... | @@ -426,14 +439,22 @@ The `google-map` element renders a Google Map. |
426 | 439 | return mapOptions; |
427 | 440 | }, |
428 | 441 | |
429 | - // watch for future updates | |
442 | + _attachChildrenToMap: function(children) { | |
443 | + if (this.map) { | |
444 | + for (var i = 0, child; child = children[i]; ++i) { | |
445 | + child.map = this.map; | |
446 | + } | |
447 | + } | |
448 | + }, | |
449 | + | |
450 | + // watch for future updates to marker objects | |
430 | 451 | _observeMarkers: function() { |
431 | 452 | // Watch for future updates. |
432 | 453 | if (this._mutationObserver) { |
433 | 454 | return; |
434 | 455 | } |
435 | - this._mutationObserver = new MutationObserver( this._updateMarkers.bind(this)); | |
436 | - this._mutationObserver.observe(this, { | |
456 | + this._mutationObserver = new MutationObserver(this._updateMarkers.bind(this)); | |
457 | + this._mutationObserver.observe(this.$.selector, { | |
437 | 458 | childList: true |
438 | 459 | }); |
439 | 460 | }, |
... | ... | @@ -461,16 +482,44 @@ The `google-map` element renders a Google Map. |
461 | 482 | this.markers = this._setMarkers(newMarkers); |
462 | 483 | |
463 | 484 | // Set the map on each marker and zoom viewport to ensure they're in view. |
464 | - if (this.markers.length && this.map) { | |
465 | - for (var i = 0, m; m = this.markers[i]; ++i) { | |
466 | - m.map = this.map; | |
467 | - } | |
468 | - } | |
485 | + this._attachChildrenToMap(this.markers); | |
469 | 486 | if (this.fitToMarkers) { |
470 | 487 | this._fitToMarkersChanged(); |
471 | 488 | } |
472 | 489 | }, |
473 | 490 | |
491 | + // watch for future updates to non-marker objects | |
492 | + _observeObjects: function() { | |
493 | + if (this._objectsMutationObserver) { | |
494 | + return; | |
495 | + } | |
496 | + this._objectsMutationObserver = new MutationObserver(this._updateObjects.bind(this)); | |
497 | + this._objectsMutationObserver.observe(this, { | |
498 | + childList: true | |
499 | + }); | |
500 | + }, | |
501 | + | |
502 | + _updateObjects: function() { | |
503 | + var newObjects = Array.prototype.slice.call( | |
504 | + Polymer.dom(this.$.objects).getDistributedNodes()); | |
505 | + | |
506 | + // Do not recompute if objects have not been added or removed. | |
507 | + if (newObjects.length === this.objects.length) { | |
508 | + var added = newObjects.filter(function(o) { | |
509 | + return this.objects.indexOf(o) === -1; | |
510 | + }.bind(this)); | |
511 | + if (added.length === 0) { | |
512 | + // Set up observer first time around. | |
513 | + this._observeObjects(); | |
514 | + return; | |
515 | + } | |
516 | + } | |
517 | + | |
518 | + this._observeObjects(); | |
519 | + this._setObjects(newObjects); | |
520 | + this._attachChildrenToMap(this.objects); | |
521 | + }, | |
522 | + | |
474 | 523 | /** |
475 | 524 | * Clears all markers from the map. |
476 | 525 | * |
... | ... | @@ -647,7 +696,7 @@ The `google-map` element renders a Google Map. |
647 | 696 | _fitToMarkersChanged: function() { |
648 | 697 | // TODO(ericbidelman): respect user's zoom level. |
649 | 698 | |
650 | - if (this.map && this.fitToMarkers) { | |
699 | + if (this.map && this.fitToMarkers && this.markers.length > 0) { | |
651 | 700 | var latLngBounds = new google.maps.LatLngBounds(); |
652 | 701 | for (var i = 0, m; m = this.markers[i]; ++i) { |
653 | 702 | latLngBounds.extend( |
... | ... | @@ -673,7 +722,7 @@ The `google-map` element renders a Google Map. |
673 | 722 | google.maps.event.addListener(this.map, 'zoom_changed', function() { |
674 | 723 | this.zoom = this.map.getZoom(); |
675 | 724 | }.bind(this)); |
676 | - | |
725 | + | |
677 | 726 | google.maps.event.addListener(this.map, 'maptypeid_changed', function() { |
678 | 727 | this.mapType = this.map.getMapTypeId(); |
679 | 728 | }.bind(this)); |
... | ... | @@ -694,7 +743,19 @@ The `google-map` element renders a Google Map. |
694 | 743 | this._listeners[name] = google.maps.event.addListener(this.map, name, function(event) { |
695 | 744 | this.fire('google-map-' + name, event); |
696 | 745 | }.bind(this)); |
697 | - } | |
746 | + }, | |
747 | + | |
748 | + _deselectMarker: function(e, detail) { | |
749 | + // If singleInfoWindow is set, update iron-selector's selected attribute to be null. | |
750 | + // Else remove the marker from iron-selector's selected array. | |
751 | + var markerIndex = this.$.selector.indexOf(e.target); | |
752 | + | |
753 | + if (this.singleInfoWindow) { | |
754 | + this.$.selector.selected = null; | |
755 | + } else if (this.$.selector.selectedValues) { | |
756 | + this.$.selector.selectedValues = this.$.selector.selectedValues.filter(function(i) {return i !== markerIndex}); | |
757 | + } | |
758 | + } | |
698 | 759 | |
699 | 760 | }); |
700 | 761 | ... | ... |
bower_components/google-map/index.html
100755 → 100644
bower_components/google-map/metadata.html
100755 → 100644
bower_components/hydrolysis/.bower.json
100755 → 100644
... | ... | @@ -19,13 +19,13 @@ |
19 | 19 | "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0", |
20 | 20 | "web-component-tester": "*" |
21 | 21 | }, |
22 | - "version": "1.19.1", | |
22 | + "version": "1.19.3", | |
23 | 23 | "homepage": "https://github.com/Polymer/hydrolysis", |
24 | - "_release": "1.19.1", | |
24 | + "_release": "1.19.3", | |
25 | 25 | "_resolution": { |
26 | 26 | "type": "version", |
27 | - "tag": "v1.19.1", | |
28 | - "commit": "e0121d748fdf5ae3f0a36252f1659f9d0ccecb68" | |
27 | + "tag": "v1.19.3", | |
28 | + "commit": "a91f380f3418d2c6aa36c559c33b45ded13413cd" | |
29 | 29 | }, |
30 | 30 | "_source": "git://github.com/Polymer/hydrolysis.git", |
31 | 31 | "_target": "^1.11", | ... | ... |
bower_components/hydrolysis/.editorconfig
100755 → 100644
bower_components/hydrolysis/.gitattributes
100755 → 100644
bower_components/hydrolysis/.travis.yml
0 → 100644
bower_components/hydrolysis/API.md
100755 → 100644
bower_components/hydrolysis/LICENSE
100755 → 100644
bower_components/hydrolysis/README.md
100755 → 100644
bower_components/hydrolysis/bower.json
100755 → 100644
bower_components/hydrolysis/hydrolysis-analyzer.html
100755 → 100644
bower_components/hydrolysis/hydrolysis.html
100755 → 100644