0

Gmaps.store.handler.getMap().zoomTo(10)私にくれますUncaught TypeError: Object #<pi> has no method 'zoomTo'

そのすぐ上で、緯度と経度を指定して Gmaps.store.handler.map.centerOn を呼び出します。適切に中央に配置されるので、ハンドラーが正しいと信じる傾向があります。私はハンドラを呼び出します

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')

また、 を呼び出すと、180 と 1 が返されます。境界でもGmaps.store.handler.bounds呼び出すことができるのではないでしょうか? .getNorthEast()コンソールは、そのような機能がないことを教えてくれます。野獣の写真はこちら…

サンディエゴを示す地図、境界が壊れている

アップデート

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
4

1 に答える 1

2

ズームを設定するGoogleの方法はsetZoom次のとおりです。

handler.getMap().setZoom(10)

境界の場合、カスタム オブジェクトは次の場所に格納されます。

handler.bounds

またはマーカーのようなすべてのカスタムオブジェクトと同様handler.mapに、Googleオブジェクトにアクセスする必要がある場合は、使用できますgetServiceObject()

handler.bounds.getServiceObject()
handler.map.getServiceObject() # same as handler.getMap()
markers[0].getServiceObject()
...
于 2013-11-14T07:34:04.450 に答える