简体   繁体   中英

Meteor google map maxZoom, minZoom and zoom level

I am using a meteor google map package and I would like to restraint the map zoom level (because I am doing a Geospatial Queries ). Normaly it should be done in my mapOptions. My code looks like this: On my template I have my map

<template name="mypage">
    <div class="map-container">
      {{> googleMap name="map" options=mapOptions}}
    </div>
</template>

Then on my Javascript helper I should have my map options like this:

Template.mypage.helpers({
  mapOptions: function(){
    if(GoogleMaps.loaded()){
      return {
        center: new google.maps.LatLng(48.8520442,2.3346246),
        zoom: 13,
        maxZoom: 15
      }
    }
  }
})

Unfortunately the maxZoom seems to not work... Are they any other possibilities to restraint the zoom ?

Alright I found the solution, A maxZoom and a minZoom have to be declared in other to have the zoom level control. So a possible solution can look like this:

Template.mypage.helpers({
  mapOptions: function(){
    if(GoogleMaps.loaded()){
      return {
        center: new google.maps.LatLng(48.8520442,2.3346246),
        zoom: 13,
        maxZoom: 20,
        minZoom: 13
      }
    }
  }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM