Gmaps.store.handler.getMap().zoomTo(10)
gives me Uncaught TypeError: Object #<pi> has no method 'zoomTo'
Directly above that, I call Gmaps.store.handler.map.centerOn, with a lat and lng, and it centers properly, so I'm inclined to believe that the handler is right. I call handler with
Gmaps.store = {} #handler, markers, userPin, eventPin
jQuery ->
Gmaps.store.handler = Gmaps.build 'Google'
Gmaps.store.handler.buildMap { internal: {id: 'map'} }, ->
Gmaps.store.markers = Gmaps.store.handler.addMarkers( $('#map').data('events'),
draggable: false
flat: false
animation: google.maps.Animation.DROP
)
google.maps.event.addListener Gmaps.store.handler.getMap(), 'click', (event) ->
addEventMarker event.latLng if $('#createEventWindow').is(':visible')
Also, when calling Gmaps.store.handler.bounds
, I'm getting 180 and 1. Shouldn't I be able to call .getNorthEast()
on the bounds as well? Console tells me there is no such function. Here's a pic of the beast...
Update
updateSearchLocation = ->
if $('#collapseOne input#location').val()
geocoder = new google.maps.Geocoder()
address = $('#collapseOne input#location').val()
geocoder.geocode address: address, (results, status) ->
if status is google.maps.GeocoderStatus.OK
latLng = results[0].geometry.location
Gmaps.store.handler.map.centerOn
lat: latLng.lat()
lng: latLng.lng()
Gmaps.store.handler.getMap().setZoom(10)
console.log Gmaps.store.handler.bounds.getServiceObject().getNorthEast()
$('#collapseOne input#ne').val Gmaps.store.handler.bounds.getServiceObject().getNorthEast()
$('#collapseOne input#sw').val Gmaps.store.handler.bounds.getServiceObject().getSouthWest()
else
throw status + ' for ' + address
google method to set zoom is setZoom
, so:
handler.getMap().setZoom(10)
For bounds, a custom object is stored here:
handler.bounds
like all custom objects like handler.map
or the markers, if you need to access the google object, you can use getServiceObject()
handler.bounds.getServiceObject()
handler.map.getServiceObject() # same as handler.getMap()
markers[0].getServiceObject()
...