Skip to content

Commit 4a589c9

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

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎src/common/mapping/WebMapV3.js‎

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

‎test/common/mapping/WebMapV3Spec.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
182182
]);
183183
});
184184

185-
it('should default showLegend to true when undefined', () => {
185+
it('should default showLegend to false when undefined', () => {
186186
instance._mapResourceInfo = {
187187
catalogs: [
188188
{
@@ -194,7 +194,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
194194
};
195195

196196
expect(instance._getLegendInfos()).toEqual([
197-
{ showLegend: true, id: 'layer1', title: 'Layer1' }
197+
{ showLegend: false, id: 'layer1', title: 'Layer1' }
198198
]);
199199
});
200200

@@ -210,7 +210,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
210210
};
211211

212212
expect(instance._getLegendInfos()).toEqual([
213-
{ showLegend: true, id: 'layer1', title: 'Layer1' }
213+
{ showLegend: false, id: 'layer1', title: 'Layer1' }
214214
]);
215215
});
216216

@@ -233,7 +233,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
233233
};
234234

235235
expect(instance._getLegendInfos(customResourceInfo)).toEqual([
236-
{ showLegend: true, id: 'customLayer', title: 'CustomLayer' }
236+
{ showLegend: false, id: 'customLayer', title: 'CustomLayer' }
237237
]);
238238
});
239239

@@ -321,7 +321,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
321321
]);
322322
});
323323

324-
it('should default showLegend to true when not specified', () => {
324+
it('should default showLegend to false when not specified', () => {
325325
const res = [];
326326
instance._getLegendInfoByCatalog({
327327
catalogType: 'layer',
@@ -330,7 +330,7 @@ describe('WebMapV3 - _getLegendInfos', () => {
330330
}, res);
331331

332332
expect(res).toEqual([
333-
{ showLegend: true, id: 'testLayer', title: 'TestLayer' }
333+
{ showLegend: false, id: 'testLayer', title: 'TestLayer' }
334334
]);
335335
});
336336

0 commit comments

Comments
 (0)