Skip to content

Commit 2e1b8cf

Browse files
committed
[bug] 1)修复搜索时,搜索结果无变化的问题
2)修复选中点图层,切换右侧(基础-类别)为城市,(风格显示为全部)时,图标未显示出来的问题
1 parent 6318545 commit 2e1b8cf

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

examples/mapboxgl-v2/src/modules/symbol-selector/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ const SymbolSelector = (props: SymbolContentProps) => {
5858
}, [activeCategory]);
5959

6060
const changeContentValues = async () => {
61-
const newValues: any[] = await updateUIContents(searchValue, iconIds, activeStyleOptions, activeStyle, ids, type);
61+
const newValues: any[] = await updateUIContents(searchValue, iconIds, activeStyleOptions, activeStyle, ids, type,activeCategory);
6262
setUIContents(newValues)
6363
}
6464

6565
useEffect(() => {
6666
changeContentValues();
67-
}, [activeCategory]);
67+
}, [activeCategory, searchValue, activeStyle]);
6868

6969
const getSymbol = (symbolInfos) => {
7070
return symbolInfos?.map(({ id, name, color, imageUrl }) => {

examples/mapboxgl-v2/src/modules/symbol-selector/symbol-selector-util.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const getAllIconIds = (allIcons, iconIds) => {
5252
return allIcons;
5353
};
5454

55-
export async function updateUIContents(searchValue, iconIds, activeStyleOptions, activeStyle, ids, type) {
55+
export async function updateUIContents(searchValue, iconIds, activeStyleOptions, activeStyle, ids, type,activeCategory) {
5656
const uiParams: any[] = [];
5757
if (searchValue) {
5858
const allIcons: { id: string, name: string }[] = [];
@@ -68,13 +68,16 @@ export async function updateUIContents(searchValue, iconIds, activeStyleOptions,
6868
return uiParams;
6969
}
7070
if (activeStyleOptions && activeStyle === 'all') {
71-
const allSymbol = getBaseAllSymbol(activeStyleOptions, ids);
71+
const symbolIds = iconIds[activeCategory]
72+
const allSymbol = getBaseAllSymbol(activeStyleOptions, symbolIds);
7273
for (const item of allSymbol) {
73-
const cardInfo = await getImageUrl(type, item.id);
74-
uiParams.push({
75-
...item,
76-
...cardInfo
77-
});
74+
for(const citem of item.symbols){
75+
const cardInfo = await getImageUrl(type, citem.id);
76+
uiParams.push({
77+
...citem,
78+
...cardInfo
79+
});
80+
}
7881
}
7982
return uiParams
8083
}

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