| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // A very incomplete Dart layer over the Google Maps JS API, v3. | 5 // A very incomplete Dart layer over the Google Maps JS API, v3. |
| 6 // See https://developers.google.com/maps/documentation/javascript/reference | 6 // See https://developers.google.com/maps/documentation/javascript/reference |
| 7 // for the underlying JS API. | 7 // for the underlying JS API. |
| 8 | 8 |
| 9 #library('maps'); | 9 #library('maps'); |
| 10 #import('dart:html'); | 10 #import('dart:html'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 GMap(this._selector, options) { | 31 GMap(this._selector, options) { |
| 32 js.invoke(''' | 32 js.invoke(''' |
| 33 function (selector, options) { | 33 function (selector, options) { |
| 34 var element = document.querySelector(selector); | 34 var element = document.querySelector(selector); |
| 35 var map = new google.maps.Map(element, options); | 35 var map = new google.maps.Map(element, options); |
| 36 element._dart_map = map; | 36 element._dart_map = map; |
| 37 }''', [_selector, options]); | 37 }''', [_selector, options]); |
| 38 } | 38 } |
| 39 | 39 |
| 40 List<MVCArray> get controls() => new MVCMapControlArrayList(this); | 40 List<MVCArray> get controls => new MVCMapControlArrayList(this); |
| 41 | 41 |
| 42 serialize() => | 42 serialize() => |
| 43 encode('function (selector) { return document.querySelector(selector)._dar
t_map; }', | 43 encode('function (selector) { return document.querySelector(selector)._dar
t_map; }', |
| 44 [_selector]); | 44 [_selector]); |
| 45 } | 45 } |
| 46 | 46 |
| 47 class LatLng extends js.Serializable { | 47 class LatLng extends js.Serializable { |
| 48 final num _lat; | 48 final num _lat; |
| 49 final num _lng; | 49 final num _lng; |
| 50 | 50 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 // TODO(vsm): Properly implement List. | 162 // TODO(vsm): Properly implement List. |
| 163 class MVCMapControlArrayList implements List<MVCArray> { | 163 class MVCMapControlArrayList implements List<MVCArray> { |
| 164 GMap _map; | 164 GMap _map; |
| 165 | 165 |
| 166 MVCMapControlArrayList(this._map); | 166 MVCMapControlArrayList(this._map); |
| 167 | 167 |
| 168 operator[](key) => new MVCMapControlArray(_map, key); | 168 operator[](key) => new MVCMapControlArray(_map, key); |
| 169 } | 169 } |
| OLD | NEW |