简体   繁体   English

流星Google地图maxZoom,minZoom和缩放级别

[英]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 ). 我正在使用流星Google地图包,并且想限制地图的缩放级别(因为我正在执行地理空间查询 )。 Normaly it should be done in my mapOptions. 通常,应该在我的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: 然后,在我的Javascript帮助器上,我应该具有以下地图选项:

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 ? 不幸的是,maxZoom似乎不起作用...是否还有其他限制变焦的可能性?

Alright I found the solution, A maxZoom and a minZoom have to be declared in other to have the zoom level control. 好了,我找到了解决方案,必须在另一个声明maxZoom和minZoom才具有缩放级别控件。 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
      }
    }
  }
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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