【问题标题】:Angular-google-map bounds exampleAngular-google-map 边界示例
【发布时间】:2014-10-14 09:58:34
【问题描述】:

不知道怎么做。 我有一堆标记,我手动计算了东北点和西南点。但看起来没有效果; (期待一个如何使用边界的例子。谢谢。

html:

<google-map center="map.center" zoom="map.zoom" pan="true" draggable="true" bounds="maps.bounds"> 

js:

$scope.map = {
        // http://angular-google-maps.org/use
        center: {
            latitude: 34.04858,
            longitude: -84.29431
        },
        zoom: 16,
        lineStyle: {
            color: '#333',
            weight: 5,
            opacity: 0.7
        },
        bounds:{}

    };    
// in another call...............
$scope.map.bounds={
                          northeast : northeast,
                          southwest: southwest
                        }
  $scope.$apply();

【问题讨论】:

    标签: angularjs google-maps-api-3


    【解决方案1】:

    我认为问题可能是缩放。 从逻辑上讲,缩放的概念与边界无关,因为边界定义了缩放。

    【讨论】:

      【解决方案2】:

      您可能需要在地图加载后动态应用它。请尝试以下操作:

      $scope.$apply(function() {
          $scope.map = { ... }
      });
      

      【讨论】:

      • 虽然此代码可能会回答问题,但提供有关 why 和/或 如何 回答问题的额外上下文将显着改善其长期价值。请edit你的答案添加一些解释。
      猜你喜欢
      • 1970-01-01
      • 2012-06-08
      • 2013-01-07
      • 2015-06-11
      • 2021-09-05
      • 2012-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多