Browse Source

修改新增农事bug

shuhao 3 weeks ago
parent
commit
66162c106a
2 changed files with 6 additions and 0 deletions
  1. 1 0
      src/components/static_map_change/Layers.js
  2. 5 0
      src/utils/ol-map/StaticImgLayer.js

+ 1 - 0
src/components/static_map_change/Layers.js

@@ -107,6 +107,7 @@ class StaticMapLayers {
     }
 
     addStaticImgLayer(map, item){
+        item.options["opacity"] = 0.5
         let imgLayer = new StaticImgLayer(item.url, item, 3, map);
         imgLayer.hide()
         if(item.legendData){

+ 5 - 0
src/utils/ol-map/StaticImgLayer.js

@@ -29,6 +29,10 @@ class StaticImgLayer extends LTBaseObject{
 	initStaticImgLayer(url,options,zIndex){
 		var minZoom = Common.BaseLayerZoom[0];
 		var maxZoom = Common.BaseLayerZoom[1];
+		let opacity = 1;
+		if(options && options.opacity != undefined){
+			opacity = options.opacity
+		}
 		if(options && options.minZoom != undefined){
 			minZoom = options.minZoom
 		}
@@ -46,6 +50,7 @@ class StaticImgLayer extends LTBaseObject{
 			source:vm.source,
 			maxZoom:maxZoom,
 			minZoom:minZoom,
+			opacity:opacity,
 			zIndex:zIndex,
 			extent:options.extent || [Infinity, -Infinity, -Infinity, Infinity]
 		})