diff --git a/loc-chase2.js b/loc-chase2.js index 4517288..15165d4 100644 --- a/loc-chase2.js +++ b/loc-chase2.js @@ -38,7 +38,6 @@ const latlng = L.latLng(lat, lng); mymap.panTo(latlng); - // ゴール位置 const goalLat = 38.892; const goalLng = 139.825; @@ -61,6 +60,7 @@ .openPopup(); } + function onSuccess(pos) { updateLocation( pos.coords.latitude, @@ -77,22 +77,14 @@ } - // =================================== -// 地図クリック / タップ対応 -// =================================== -function onMapSelect(e) { - stopLOC(); // GPS停止 - updateLocation(e.latlng.lat, e.latlng.lng); -} + mymap.on("mousedown touchstart", function (e) { + stopLOC(); + updateLocation( + e.latlng.lat, + e.latlng.lng + ); + }); -// PC(マウス) -mymap.on("click", onMapSelect); - -// スマホ(タッチ) -mymap.on("tap", onMapSelect); - - - document.getElementById("start") .addEventListener("click", tryWatchLOC);