[Control] googleMap

Part of: mobl::ui::googlemap

Arguments:

  • coords : Coordinates: the coordinates of the center of the map
  • markers : Collection<MapMarker>: a collection containing MapMarker objects to be rendered on the map.
  • width : Num (optional): map width, defaults to full-screen width
  • height : Num = 240: map height
  • zoom : Num = 8: zoom level
  • onready : Callback (optional): callback to execute when map has loaded

Renders a google map.

Example:

application test
import mobl::ui::generic
import mobl::ui::googlemap
import mobl::location
screen root() {
  var markers = Collection<MapMarker>()
  var lat = 52.37818
  var lon = 4.899366
  var title = "Here"
  googleMap(Coordinates(latitude=52.37818,
                        longitude=4.899366),
            markers=markers, height=240,
            zoom=14, onready={})
  group {
    item { numField(lat, label="Latitude") }
    item { numField(lon, label="Longitude") }
    item { textField(title, label="Title") }
  }
  button("Add", onclick={
    log(lat);
    markers.add(MapMarker(coords=Coordinates(
                           latitude=lat, longitude=lon),
                          title=title, onclick={
      alert("Hello!");
    }));
  })
  button("Clear", onclick={
    markers.destroyAll();
  })
}
mobl/ui/googlemap/googlemap.txt · Last modified: 2020/04/11 08:17 by Zef Hemel