Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
969 B
4
Indexable
Never

$(() => {
  //call loadmaps()
  console.log("startup")
  // $('.new-map').on('click', showCreateMapForm);
  const $mapsContainer = $('#maps-container');
  console.log("logging maps container", $mapsContainer);
  const map = new google.maps.Map($('#maps-container')[0], {center: {lat: 50, lng: 92}, zoom: 5})
  resetMap(map)

  // $('reset').on('click', resetMap)

  // //click event to capture data from map and send to map POST route create
  // $('new-map'.on('click'))

});

const showCreateMapForm = function(){
  alert("showing the form")
 $('.create-map-form').removeClass("hidden")

}

//create new localized map
const resetMap = function(map){

  // const map = new google.maps.Map(container, {zoom: 5})

  //find current location
  navigator.geolocation.getCurrentPosition(position =>{
    const lat = position.coords.latitude
    const long = position.coords.longitude
    const center = {lat: lat, lng: long}
    map.setCenter(center)

  })

  return map

}