diff --git a/map4.js b/map4.js index c8505fd..f6fbbd9 100644 --- a/map4.js +++ b/map4.js @@ -3,9 +3,7 @@ // =================================== const SUPABASE_URL = "https://ogtlmtnjkpsxsqzqlacj.supabase.co"; const SUPABASE_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9ndGxtdG5qa3BzeHNxenFsYWNqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjMyOTU3NjUsImV4cCI6MjA3ODg3MTc2NX0.JnCE7oUQwrSgGqiu-QRbwnaLBZrO8JX1_RUb37VIMFI"; - const supa = window.supabase.createClient(SUPABASE_URL, SUPABASE_KEY); - // =================================== let deviceId = localStorage.getItem("deviceId"); if (!deviceId) { @@ -19,7 +17,6 @@ let selfMarker = null; let otherMarkers = []; let latestByDevice = {}; - let lastLat = null; let lastLng = null; @@ -36,9 +33,8 @@ } // =================================== -// 小型ピンを統一して使う -// 自分 → 緑 -// 他人 → 黄色 +// 小型ピン(ズレなし) +// 自分=緑 / 他人=黄 // =================================== function createLabeledMarker(lat, lng, name, isSelf) { const pinUrl = isSelf @@ -80,13 +76,6 @@ L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", { maxZoom: 19, }).addTo(map); - - // ズームに応じてピン縮小(自然に) - map.on("zoom", () => { - const zoom = map.getZoom(); - const scale = zoom / 16; - document.documentElement.style.setProperty("--pin-scale", scale); - }); } // =================================== @@ -130,10 +119,8 @@ li.classList.add(isOnline ? "online" : "offline"); -// ピンと同じ色: 自分=緑ピン / 他の人=黄色ピン const circleColor = (row.device_id === deviceId) ? "#58c16b" : "#FFD700"; - const icon = document.createElement("div"); icon.className = "member-icon"; icon.style.background = circleColor; @@ -225,9 +212,9 @@ renderSelfMarker(); await saveMyLocation(lastLat, lastLng); } catch {} - }, 2000); + }, 2000); // ← 2秒で自分更新(リアルタイム) - setInterval(showOtherUsers, 1000); + setInterval(showOtherUsers, 1000); // ← 1秒で他人更新 document.getElementById("exitBtn").onclick = () => (location.href = "index.html");