Skip to content

Commit 82a2965

Browse files
[fix]isvj-5215兼容就的customSetings review by qiw
1 parent 2c3a524 commit 82a2965

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3164,7 +3164,7 @@ export class WebMap extends Observable {
31643164

31653165
//生成styleGroup
31663166
let styleGroup = [];
3167-
const usedColors = this.getCustomSettingColors(customSettings, names, featureType).map(item => item.toLowerCase());
3167+
const usedColors = this.getCustomSettingColors(customSettings, featureType).map(item => item.toLowerCase());
31683168
const curentColors = this.getUniqueColors(themeSetting.colors || this.defaultParameters.themeSetting.colors, names.length + Object.keys(customSettings).length).map(item => item.toLowerCase());
31693169
const newColors = difference(curentColors, usedColors);
31703170
for(let index = 0; index < names.length; index++) {
@@ -3222,6 +3222,11 @@ export class WebMap extends Observable {
32223222
const keys = Object.keys(customSettings);
32233223
const colors = [];
32243224
keys.forEach(key => {
3225+
//兼容之前自定义只存储一个color
3226+
if (Util.isString(customSettings[key])) {
3227+
colors.push(customSettings[key]);
3228+
return;
3229+
}
32253230
if (featureType === "LINE") {
32263231
colors.push(customSettings[key].strokeColor);
32273232
} else {

test/openlayers/mapping/WebMapSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ describe('openlayers_WebMap', () => {
338338
]
339339
}
340340
const res = await datavizWebmap.getUniqueStyleGroup(parameters, [{ get: () => ({ 'UserID': 30, 'UserID': 0 }) }]);
341-
expect(res.length).toBe(2);
341+
expect(res.length).toBe(1);
342342
done();
343343
}
344344
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy