fix(map): S57 ENC 오버레이 스타일 로드 완료 대기 후 레이어 추가
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
부모
38d11df363
커밋
08bcfbf24d
@ -137,14 +137,21 @@ export function S57EncOverlay({ visible }: S57EncOverlayProps) {
|
|||||||
if (!map) return;
|
if (!map) return;
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
addEncLayers(map);
|
const doAdd = () => addEncLayers(map);
|
||||||
|
|
||||||
|
if (map.isStyleLoaded()) {
|
||||||
|
doAdd();
|
||||||
} else {
|
} else {
|
||||||
removeEncLayers(map);
|
map.once('style.load', doAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (map) removeEncLayers(map);
|
map.off('style.load', doAdd);
|
||||||
|
removeEncLayers(map);
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
removeEncLayers(map);
|
||||||
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [visible, mapRef]);
|
}, [visible, mapRef]);
|
||||||
|
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user