From 66d54d23c4ce72a8ad04b1bad2f5e2217d4ce562 Mon Sep 17 00:00:00 2001 From: luoxiao Date: Fri, 26 Jul 2024 16:10:02 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=E3=80=91=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8D=95=E5=80=BC=E4=B8=93=E9=A2=98=E5=9B=BE=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=A0=B7=E5=BC=8F=E6=98=AF=E9=80=8F=E6=98=8E=E5=BA=A6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=9C=B0=E5=9B=BE=E5=8A=A0=E8=BD=BD=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mapboxgl/web-map/WebMapV2.ts | 3 +++ src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js | 2 +- test/unit/mocks/data/WebMap/uniqueLayer_polygon.json | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mapboxgl/web-map/WebMapV2.ts b/src/mapboxgl/web-map/WebMapV2.ts index bc39871f..fa0fc316 100644 --- a/src/mapboxgl/web-map/WebMapV2.ts +++ b/src/mapboxgl/web-map/WebMapV2.ts @@ -1566,6 +1566,9 @@ export default class WebMap extends WebMapBase { for (const key in expressionMap) { if (Object.prototype.hasOwnProperty.call(expressionMap, key)) { const expression = expressionMap[key]; + if (!Array.isArray(expression)) { + continue; + } const defaultStyleItem = defultLayerStyle[key] || defaultValueFactory[key]; const styleItem = { [key]: defaultStyleItem }; // 从customsetting里取了透明度和color一起处理了,layerinfo.style里的透明度就不需要了 diff --git a/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js b/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js index 218f6801..025e6070 100644 --- a/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js +++ b/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js @@ -308,7 +308,7 @@ describe('WebMapViewModel.spec', () => { expect(item.renderLayers.length).toBeGreaterThanOrEqual(1); }) expect(viewModel.map.getStyle().layers.find((item)=>{return item.type === 'fill'}).paint['fill-opacity']).toBe(1); - expect(viewModel.map.getStyle().layers.find((item)=>{return item.type === 'fill'}).paint['fill-color'][3]).toBe('rgba(213, 62, 79, 0.9)'); + expect(viewModel.map.getStyle().layers.find((item)=>{return item.type === 'fill'}).paint['fill-color'][3]).toBe('rgba(230, 245, 153, 0.7)'); done(); }; viewModel.on({ addlayerssucceeded: callback }); diff --git a/test/unit/mocks/data/WebMap/uniqueLayer_polygon.json b/test/unit/mocks/data/WebMap/uniqueLayer_polygon.json index fdafd574..e080098a 100644 --- a/test/unit/mocks/data/WebMap/uniqueLayer_polygon.json +++ b/test/unit/mocks/data/WebMap/uniqueLayer_polygon.json @@ -15,12 +15,12 @@ "layerType": "UNIQUE", "visible": true, "themeSetting": { - "themeField": "行政区划_c", + "themeField": "机场", "customSettings": { - "四川省": { + "北京/首都": { "strokeWidth": 1, "fillColor": "#e6f599", - "fillOpacity": 0.9, + "fillOpacity": 0.7, "lineDash": "solid", "strokeColor": "#ffffff", "type": "POLYGON",