Skip to content

Commit 3f8cdb7

Browse files
committed
fix:MD图例,沿用地图时,显示了不该显示的图例(MS添加图层后不操作图例,showLegend属性不存在)
AI-GEN: 100% gpt-6-luna
1 parent a2f400f commit 3f8cdb7

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/common/mapping/WebMapV3.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
402402
}
403403
if (catalogType === 'layer') {
404404
res.push({
405-
showLegend: showLegend !== false,
405+
showLegend: showLegend === true,
406406
id: id,
407407
title: title
408408
});

‎test/common/mapping/WebMapV3Spec.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
213213
]);
214214
});
215215

216-
it('should default showLegend to true when undefined', () => {
216+
it('should default showLegend to false when undefined', () => {
217217
instance._mapResourceInfo = {
218218
catalogs: [
219219
{
@@ -227,7 +227,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
227227
const result = instance._getLegendInfos();
228228

229229
expect(result).toEqual([
230-
{ showLegend: true, id: 'layer1', title: 'Layer1' }
230+
{ showLegend: false, id: 'layer1', title: 'Layer1' }
231231
]);
232232
});
233233

@@ -245,7 +245,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
245245
const result = instance._getLegendInfos();
246246

247247
expect(result).toEqual([
248-
{ showLegend: true, id: 'layer1', title: 'Layer1' }
248+
{ showLegend: false, id: 'layer1', title: 'Layer1' }
249249
]);
250250
});
251251

@@ -349,7 +349,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
349349
]);
350350
});
351351

352-
it('should default showLegend to true when not specified', () => {
352+
it('should default showLegend to false when not specified', () => {
353353
const res = [];
354354
const catalog = {
355355
catalogType: 'layer',
@@ -360,7 +360,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
360360
instance._getLegendInfoByCatalog(catalog, res);
361361

362362
expect(res).toEqual([
363-
{ showLegend: true, id: 'testLayer', title: 'TestLayer' }
363+
{ showLegend: false, id: 'testLayer', title: 'TestLayer' }
364364
]);
365365
});
366366

0 commit comments

Comments
 (0)