release: v0.3 배포 (지도 최적화 + 설정 영속화) #13
@ -10,6 +10,7 @@ import type { ZonesGeoJson } from '../../../entities/zone/api/useZones';
|
|||||||
import type { MapToggleState } from '../../../features/mapToggles/MapToggles';
|
import type { MapToggleState } from '../../../features/mapToggles/MapToggles';
|
||||||
import type { BaseMapId, MapProjectionId } from '../types';
|
import type { BaseMapId, MapProjectionId } from '../types';
|
||||||
import { kickRepaint, onMapStyleReady } from '../lib/mapCore';
|
import { kickRepaint, onMapStyleReady } from '../lib/mapCore';
|
||||||
|
import { guardedSetVisibility } from '../lib/layerHelpers';
|
||||||
|
|
||||||
export function useZonesLayer(
|
export function useZonesLayer(
|
||||||
mapRef: MutableRefObject<maplibregl.Map | null>,
|
mapRef: MutableRefObject<maplibregl.Map | null>,
|
||||||
@ -48,22 +49,13 @@ export function useZonesLayer(
|
|||||||
|
|
||||||
const ensure = () => {
|
const ensure = () => {
|
||||||
if (projectionBusyRef.current) return;
|
if (projectionBusyRef.current) return;
|
||||||
const visibility = overlays.zones ? 'visible' : 'none';
|
const visibility: 'visible' | 'none' = overlays.zones ? 'visible' : 'none';
|
||||||
try {
|
// globe 모드에서 fill polygon은 tessellation으로 vertex 65535 초과 → 숨김
|
||||||
if (map.getLayer(fillId)) map.setLayoutProperty(fillId, 'visibility', visibility);
|
// (해안선 디테일 2100+ vertex가 globe에서 100,000+로 폭증하여 노란 막대 아티팩트 발생)
|
||||||
} catch {
|
const fillVisibility: 'visible' | 'none' = projection === 'globe' ? 'none' : visibility;
|
||||||
// ignore
|
guardedSetVisibility(map, fillId, fillVisibility);
|
||||||
}
|
guardedSetVisibility(map, lineId, visibility);
|
||||||
try {
|
guardedSetVisibility(map, labelId, visibility);
|
||||||
if (map.getLayer(lineId)) map.setLayoutProperty(lineId, 'visibility', visibility);
|
|
||||||
} catch {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (map.getLayer(labelId)) map.setLayoutProperty(labelId, 'visibility', visibility);
|
|
||||||
} catch {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!zones) return;
|
if (!zones) return;
|
||||||
if (!map.isStyleLoaded()) return;
|
if (!map.isStyleLoaded()) return;
|
||||||
@ -160,7 +152,7 @@ export function useZonesLayer(
|
|||||||
] as unknown as number)
|
] as unknown as number)
|
||||||
: 0.12,
|
: 0.12,
|
||||||
},
|
},
|
||||||
layout: { visibility },
|
layout: { visibility: fillVisibility },
|
||||||
} as unknown as LayerSpecification,
|
} as unknown as LayerSpecification,
|
||||||
before,
|
before,
|
||||||
);
|
);
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user