diff options
Diffstat (limited to 'node_modules/montage-google/map.reel')
-rw-r--r-- | node_modules/montage-google/map.reel/map.js | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/node_modules/montage-google/map.reel/map.js b/node_modules/montage-google/map.reel/map.js index 3ba7fff7..fc104df5 100644 --- a/node_modules/montage-google/map.reel/map.js +++ b/node_modules/montage-google/map.reel/map.js | |||
@@ -28,12 +28,12 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
28 | }; | 28 | }; |
29 | } | 29 | } |
30 | }, | 30 | }, |
31 | 31 | ||
32 | _geoCoder: {value: null}, | 32 | _geoCoder: {value: null}, |
33 | 33 | ||
34 | // HTMLElement to load the Map into | 34 | // HTMLElement to load the Map into |
35 | mapEl: {value: null}, | 35 | mapEl: {value: null}, |
36 | 36 | ||
37 | _mapLoaded: { | 37 | _mapLoaded: { |
38 | enumerable: false, | 38 | enumerable: false, |
39 | value: false | 39 | value: false |
@@ -42,14 +42,14 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
42 | enumerable: false, | 42 | enumerable: false, |
43 | value: false | 43 | value: false |
44 | }, | 44 | }, |
45 | 45 | ||
46 | // Sunnyvale, CA | 46 | // Sunnyvale, CA |
47 | defaultLatLng: { | 47 | defaultLatLng: { |
48 | value: {lat: 37.37, lng: -122.03} | 48 | value: {lat: 37.37, lng: -122.03} |
49 | }, | 49 | }, |
50 | 50 | ||
51 | _latLng: { | 51 | _latLng: { |
52 | value: this.defaultLatLng, | 52 | value: this.defaultLatLng, |
53 | distinct: true | 53 | distinct: true |
54 | }, | 54 | }, |
55 | latLng: { | 55 | latLng: { |
@@ -75,7 +75,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
75 | var self = this, geocoder = this._geoCoder; | 75 | var self = this, geocoder = this._geoCoder; |
76 | this._center = value; | 76 | this._center = value; |
77 | if(this._mapLoaded) { | 77 | if(this._mapLoaded) { |
78 | 78 | ||
79 | if(String.isString(value)) { | 79 | if(String.isString(value)) { |
80 | // geocode | 80 | // geocode |
81 | geocoder.geocode( { 'address': value}, function(results, status) { | 81 | geocoder.geocode( { 'address': value}, function(results, status) { |
@@ -92,9 +92,9 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
92 | // default location | 92 | // default location |
93 | this.latLng = this.defaultLatLng; | 93 | this.latLng = this.defaultLatLng; |
94 | } | 94 | } |
95 | 95 | ||
96 | } | 96 | } |
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | } | 100 | } |
@@ -113,7 +113,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
113 | } | 113 | } |
114 | } | 114 | } |
115 | }, | 115 | }, |
116 | 116 | ||
117 | trafficLayer: {value: null}, | 117 | trafficLayer: {value: null}, |
118 | _traffic: {value: null}, | 118 | _traffic: {value: null}, |
119 | traffic: { | 119 | traffic: { |
@@ -127,12 +127,12 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
127 | } | 127 | } |
128 | } | 128 | } |
129 | }, | 129 | }, |
130 | 130 | ||
131 | 131 | ||
132 | zoomValue: { | 132 | zoomValue: { |
133 | value: 8 | 133 | value: 8 |
134 | }, | 134 | }, |
135 | 135 | ||
136 | __places: {value: null}, | 136 | __places: {value: null}, |
137 | _places: { | 137 | _places: { |
138 | get: function() { | 138 | get: function() { |
@@ -145,11 +145,11 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
145 | } | 145 | } |
146 | } | 146 | } |
147 | }, | 147 | }, |
148 | 148 | ||
149 | _getPlaces: { | 149 | _getPlaces: { |
150 | value: function(type, keyword) { | 150 | value: function(type, keyword) { |
151 | var self = this; | 151 | var self = this; |
152 | var request = { | 152 | var request = { |
153 | location: new window.google.maps.LatLng(this.latLng.lat, this.latLng.lng), | 153 | location: new window.google.maps.LatLng(this.latLng.lat, this.latLng.lng), |
154 | radius: 5000, | 154 | radius: 5000, |
155 | types: [type] | 155 | types: [type] |
@@ -168,7 +168,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
168 | }); | 168 | }); |
169 | } | 169 | } |
170 | }, | 170 | }, |
171 | 171 | ||
172 | _infoWindow: {value: null}, | 172 | _infoWindow: {value: null}, |
173 | _markers: {value: null}, | 173 | _markers: {value: null}, |
174 | _createMarker: { | 174 | _createMarker: { |
@@ -192,20 +192,20 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
192 | icon = '41-picture-frame.png'; | 192 | icon = '41-picture-frame.png'; |
193 | break; | 193 | break; |
194 | case 'gas_station': | 194 | case 'gas_station': |
195 | icon = '47-fuel.png'; | 195 | icon = '47-fuel.png'; |
196 | break; | 196 | break; |
197 | }; | 197 | }; |
198 | if(icon) { | 198 | if(icon) { |
199 | image = new google.maps.MarkerImage('images/' + icon); | 199 | image = new google.maps.MarkerImage('images/' + icon); |
200 | } | 200 | } |
201 | var options = { | 201 | var options = { |
202 | map: map, | 202 | map: map, |
203 | position: place.geometry.location | 203 | position: place.geometry.location |
204 | }; | 204 | }; |
205 | if(image) { | 205 | if(image) { |
206 | options.icon = image; | 206 | options.icon = image; |
207 | } | 207 | } |
208 | 208 | ||
209 | var marker = new google.maps.Marker(options); | 209 | var marker = new google.maps.Marker(options); |
210 | if(!this._markers) { | 210 | if(!this._markers) { |
211 | this._markers = []; | 211 | this._markers = []; |
@@ -219,7 +219,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
219 | }); | 219 | }); |
220 | } | 220 | } |
221 | }, | 221 | }, |
222 | 222 | ||
223 | _removeAllMarkers: { | 223 | _removeAllMarkers: { |
224 | value: function() { | 224 | value: function() { |
225 | if(this._markers && this._markers.length > 0) { | 225 | if(this._markers && this._markers.length > 0) { |
@@ -231,7 +231,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
231 | } | 231 | } |
232 | } | 232 | } |
233 | }, | 233 | }, |
234 | 234 | ||
235 | 235 | ||
236 | /** | 236 | /** |
237 | Description TODO | 237 | Description TODO |
@@ -240,11 +240,11 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
240 | draw: { | 240 | draw: { |
241 | enumerable: false, | 241 | enumerable: false, |
242 | value: function () { | 242 | value: function () { |
243 | 243 | ||
244 | if(this._mapLoaded) { | 244 | if(this._mapLoaded) { |
245 | var latLng = this.latLng || this.defaultLatLng; | 245 | var latLng = this.latLng || this.defaultLatLng; |
246 | if(!this._map) { | 246 | if(!this._map) { |
247 | var map; | 247 | var map; |
248 | var myOptions = { | 248 | var myOptions = { |
249 | zoom: this.zoomValue, | 249 | zoom: this.zoomValue, |
250 | center: new window.google.maps.LatLng(latLng.lat, latLng.lng), | 250 | center: new window.google.maps.LatLng(latLng.lat, latLng.lng), |
@@ -258,9 +258,9 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
258 | var latLng = new window.google.maps.LatLng(latLng.lat, latLng.lng); | 258 | var latLng = new window.google.maps.LatLng(latLng.lat, latLng.lng); |
259 | map.setCenter(latLng); | 259 | map.setCenter(latLng); |
260 | var marker = new google.maps.Marker({ | 260 | var marker = new google.maps.Marker({ |
261 | map: map, | 261 | map: map, |
262 | position: latLng | 262 | position: latLng |
263 | }); | 263 | }); |
264 | 264 | ||
265 | var places = this._places; | 265 | var places = this._places; |
266 | if(places && places.length > 0) { | 266 | if(places && places.length > 0) { |
@@ -269,8 +269,8 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
269 | for (var i = 0; i < places.length; i++) { | 269 | for (var i = 0; i < places.length; i++) { |
270 | this._createMarker(places[i]); | 270 | this._createMarker(places[i]); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | 273 | ||
274 | if(this.traffic === true) { | 274 | if(this.traffic === true) { |
275 | this.trafficLayer = new google.maps.TrafficLayer(); | 275 | this.trafficLayer = new google.maps.TrafficLayer(); |
276 | this.trafficLayer.setMap(map); | 276 | this.trafficLayer.setMap(map); |
@@ -278,12 +278,20 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ | |||
278 | if(this.trafficLayer) { | 278 | if(this.trafficLayer) { |
279 | this.trafficLayer.setMap(null); | 279 | this.trafficLayer.setMap(null); |
280 |