2015-06-05 37 views
1

我正在使用angular-leaflet-directive。有沒有更改圖層不透明度的選項?Angular-Leaflet-Directive:設置圖層的不透明度

使用'常規'傳單我可以使用layer.setOpacity(0.5)。但是在角單張指令中似乎沒有選擇。

編輯: 這裏是我的傳單配置:

angular.module('epic-taxi') 
    .controller('MainController', ['$scope', function($scope) { 

    $scope.initMap = function() { 
     angular.extend($scope, { 
     newYork: { 
      lat: 40.7304783951045, 
      lng: -73.98880004882812, 
      zoom: 12 
     }, 
     layers: { 
      baselayers: { 
      mapbox_light: { 
       name: 'Light', 
       type: 'xyz', 
       url: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png' 
      } 
      }, 
      overlays: { 
      subway: { 
       name: 'Subway', 
       visible: true, 
       type: 'group', 
       opacity: 0.1 // not working 
      } 
      } 
     } 
     }); 
    }; 
    }]); 

我想換一個包含多個路徑的「地鐵」疊加的不透明度。

回答

0

你看過their docs嗎?

app.controller("CenterController", [ '$scope', function($scope) { 
    angular.extend($scope, { 
     center: { 
      lat: 40.095, 
      lng: -3.823, 
      zoom: 4, 
      opacity: 0.5 
     }, 
     defaults: { 
      scrollWheelZoom: false 
     } 
    }); 
}]); 
+0

那如何解決我的問題?我想改變一個特定圖層的不透明度。 – fwind

+0

創建特定圖層時...使用此屬性 - 「不透明度」。如果您需要更多幫助,請發佈部分代碼。 –

+0

不透明屬性似乎什麼都不做。我添加了我的地圖初始化。我想改變包含多條路徑的'地鐵'疊加層的不透明度。 – fwind

-1

嘗試使用這樣的:

overlays: { 
      subway: { 
       name: 'Subway', 
       visible: true, 
       type: 'group', 
       layeroptions: { 
        opacity: 0.1 
       } 
      }, 
      } 
+0

歡迎來到Stack Overflow!額外的解釋會改善你的答案。 – ryanyuyu