Skip to content

Commit 1727af8

Browse files
[fix]isvj-5215兼容就的customSetings review by qiw
1 parent 20873d1 commit 1727af8

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
@@ -3167,7 +3167,7 @@ export class WebMap extends Observable {
31673167

31683168
//生成styleGroup
31693169
let styleGroup = [];
3170-
const usedColors = this.getCustomSettingColors(customSettings, names, featureType).map(item => item.toLowerCase());
3170+
const usedColors = this.getCustomSettingColors(customSettings, featureType).map(item => item.toLowerCase());
31713171
const curentColors = this.getUniqueColors(themeSetting.colors || this.defaultParameters.themeSetting.colors, names.length + Object.keys(customSettings).length).map(item => item.toLowerCase());
31723172
const newColors = difference(curentColors, usedColors);
31733173
for(let index = 0; index < names.length; index++) {
@@ -3225,6 +3225,11 @@ export class WebMap extends Observable {
32253225
const keys = Object.keys(customSettings);
32263226
const colors = [];
32273227
keys.forEach(key => {
3228+
//兼容之前自定义只存储一个color
3229+
if (Util.isString(customSettings[key])) {
3230+
colors.push(customSettings[key]);
3231+
return;
3232+
}
32283233
if (featureType === "LINE") {
32293234
colors.push(customSettings[key].strokeColor);
32303235
} 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)