fix(map): S57 ENC �������� ��Ÿ�� �ε� �Ϸ� ���� �� ���̾� �߰� #155
@ -137,14 +137,21 @@ export function S57EncOverlay({ visible }: S57EncOverlayProps) {
|
||||
if (!map) return;
|
||||
|
||||
if (visible) {
|
||||
addEncLayers(map);
|
||||
const doAdd = () => addEncLayers(map);
|
||||
|
||||
if (map.isStyleLoaded()) {
|
||||
doAdd();
|
||||
} else {
|
||||
map.once('style.load', doAdd);
|
||||
}
|
||||
|
||||
return () => {
|
||||
map.off('style.load', doAdd);
|
||||
removeEncLayers(map);
|
||||
};
|
||||
} else {
|
||||
removeEncLayers(map);
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (map) removeEncLayers(map);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [visible, mapRef]);
|
||||
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user