Simplify findmydevice map controls

This commit is contained in:
seo
2026-06-18 03:55:44 +09:00
parent 3dfb506474
commit 08bd2ab4a4
2 changed files with 3 additions and 55 deletions
+1 -52
View File
@@ -165,10 +165,6 @@ const deviceLang = (navigator.language || navigator.userLanguage || "en").starts
history: "기록",
startTime: "시작",
endTime: "종료",
mapNormal: "일반",
mapSatellite: "위성",
mapTraffic: "교통",
mapStreet: "거리뷰",
mapFit: "전체",
mapPlay: "재생",
mapPause: "정지",
@@ -376,10 +372,6 @@ const deviceLang = (navigator.language || navigator.userLanguage || "en").starts
history: "History",
startTime: "Start",
endTime: "End",
mapNormal: "Normal",
mapSatellite: "Satellite",
mapTraffic: "Traffic",
mapStreet: "Street",
mapFit: "Fit",
mapPlay: "Play",
mapPause: "Pause",
@@ -448,9 +440,6 @@ const deviceLang = (navigator.language || navigator.userLanguage || "en").starts
stayPoints: [],
homeStats: null,
filterOutliers: true,
layers: {},
layerActive: {},
activeMapType: 'normal',
openInfoWindow: null,
mapClickHandlerAdded: false,
initialInfoOpened: false,
@@ -1137,16 +1126,9 @@ function initMap(latlng, accuracy = 50) {
createMainMarker(latlng);
createAccuracyCircle(latlng, accuracy);
updateHomeCircle();
initMapLayers();
ensureMapTools();
}
function initMapLayers() {
if (!mapState.map || mapState.layers.traffic) return;
mapState.layers.traffic = new naver.maps.TrafficLayer();
mapState.layers.street = new naver.maps.StreetLayer();
}
function ensureMapTools() {
const container = document.getElementById('mapContainer') || document.getElementById('map')?.parentElement;
if (!container || document.getElementById('mapTools')) return;
@@ -1161,10 +1143,6 @@ function ensureMapTools() {
tools.id = 'mapTools';
tools.className = 'map-tools';
tools.innerHTML = `
<button type="button" class="map-tool active" data-map-action="normal"></button>
<button type="button" class="map-tool" data-map-action="satellite"></button>
<button type="button" class="map-tool" data-map-action="traffic"></button>
<button type="button" class="map-tool" data-map-action="street"></button>
<button type="button" class="map-tool" data-map-action="fit"></button>
<button type="button" class="map-tool" data-map-action="play"></button>
<button type="button" class="map-tool active" data-map-action="filter"></button>
@@ -1206,10 +1184,6 @@ function ensureMapTools() {
function updateMapToolLabels() {
const t = translations[langCode] || translations.ko;
const labelMap = {
normal: t.mapNormal,
satellite: t.mapSatellite,
traffic: t.mapTraffic,
street: t.mapStreet,
fit: t.mapFit,
play: mapState.playbackTimer ? t.mapPause : t.mapPlay,
filter: t.historyFiltered,
@@ -1227,27 +1201,6 @@ function updateMapToolLabels() {
function handleMapTool(action) {
if (!mapState.map) return;
if (action === 'normal' || action === 'satellite') {
mapState.activeMapType = action;
const mapTypes = naver.maps.MapTypeId || {};
const typeId = action === 'satellite'
? (mapTypes.HYBRID || mapTypes.SATELLITE || 'satellite')
: (mapTypes.NORMAL || 'normal');
mapState.map.setMapTypeId(typeId);
document.querySelectorAll('[data-map-action="normal"], [data-map-action="satellite"]').forEach(button => {
button.classList.toggle('active', button.dataset.mapAction === action);
});
return;
}
if (action === 'traffic' || action === 'street') {
const layer = mapState.layers[action];
if (!layer) return;
const nextActive = !mapState.layerActive[action];
layer.setMap(nextActive ? mapState.map : null);
mapState.layerActive[action] = nextActive;
document.querySelector(`[data-map-action="${action}"]`)?.classList.toggle('active', nextActive);
return;
}
if (action === 'fit') {
fitHistoryOrCurrentBounds();
return;
@@ -1698,11 +1651,7 @@ function drawSpeedTrack(points) {
strokeLineJoin: 'round',
endIcon: naver.maps.PointingIcon?.BLOCK_ARROW,
endIconSize: 16,
clickable: true
});
naver.maps.Event.addListener(line, 'click', () => {
const panel = document.getElementById('historySummaryPanel');
if (panel) panel.hidden = !panel.hidden;
clickable: false
});
mapState.trackLines.push(line);
mapState.trackLine = line;