Spaces:
Running
Running
Update index.html
Browse files- index.html +55 -56
index.html
CHANGED
|
@@ -593,54 +593,65 @@
|
|
| 593 |
// イベントリスナーの設定
|
| 594 |
setupEventListeners();
|
| 595 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 596 |
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
}).addTo(map);
|
| 603 |
-
|
| 604 |
-
// マーカーイベントの設定
|
| 605 |
-
map.on("click", function(e) {
|
| 606 |
-
if (nextMarkerEdit) {
|
| 607 |
-
return;
|
| 608 |
-
}
|
| 609 |
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
});
|
| 626 |
-
|
| 627 |
-
marker.on("mouseout", function() {
|
| 628 |
-
if (hoveredMarker === marker) {
|
| 629 |
-
hoveredMarker = null;
|
| 630 |
-
}
|
| 631 |
-
});
|
| 632 |
-
|
| 633 |
-
document.getElementById("marker-icon-url").value = "https://unpkg.com/leaflet@1.9.3/dist/images/marker-icon-2x.png";
|
| 634 |
-
openEditor(marker);
|
| 635 |
-
saveCurrentMapToStorage();
|
| 636 |
-
}
|
| 637 |
});
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
|
|
|
| 642 |
});
|
| 643 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 644 |
|
| 645 |
// イベントリスナーの設定
|
| 646 |
function setupEventListeners() {
|
|
@@ -1204,18 +1215,6 @@
|
|
| 1204 |
console.error('コピーに失敗しました:', err);
|
| 1205 |
});
|
| 1206 |
}
|
| 1207 |
-
|
| 1208 |
-
// ポップアップが開いた時の処理
|
| 1209 |
-
map.on('popupopen', function(e) {
|
| 1210 |
-
const marker = e.popup._source;
|
| 1211 |
-
if (nextMarkerEdit) {
|
| 1212 |
-
openEditor(marker);
|
| 1213 |
-
nextMarkerEdit = false;
|
| 1214 |
-
document.getElementById("edit-next-marker").textContent = "次のマーカーを編集";
|
| 1215 |
-
document.getElementById("edit-next-marker").classList.remove("danger");
|
| 1216 |
-
document.getElementById("edit-next-marker").classList.add("secondary");
|
| 1217 |
-
}
|
| 1218 |
-
});
|
| 1219 |
</script>
|
| 1220 |
</body>
|
| 1221 |
</html>
|
|
|
|
| 593 |
// イベントリスナーの設定
|
| 594 |
setupEventListeners();
|
| 595 |
};
|
| 596 |
+
// マップ初期化
|
| 597 |
+
function initMap() {
|
| 598 |
+
map = L.map("map").setView([33.321797711641395, 130.52061378343208], 16);
|
| 599 |
+
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
| 600 |
+
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors'
|
| 601 |
+
}).addTo(map);
|
| 602 |
|
| 603 |
+
// マーカーイベントの設定
|
| 604 |
+
map.on("click", function(e) {
|
| 605 |
+
if (nextMarkerEdit) {
|
| 606 |
+
return;
|
| 607 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 608 |
|
| 609 |
+
if (editingMarker) {
|
| 610 |
+
const latlng = e.latlng;
|
| 611 |
+
editingMarker.setLatLng([latlng.lat, latlng.lng]);
|
| 612 |
+
document.getElementById("marker-lat").value = latlng.lat;
|
| 613 |
+
document.getElementById("marker-lng").value = latlng.lng;
|
| 614 |
+
updatePreviewSize();
|
| 615 |
+
saveCurrentMapToStorage();
|
| 616 |
+
} else {
|
| 617 |
+
const latlng = e.latlng;
|
| 618 |
+
const marker = L.marker(latlng).addTo(map);
|
| 619 |
+
marker.bindPopup("新しいマーカーのポップアップ");
|
| 620 |
+
marker.bindTooltip("新しいマーカーのツールチップ");
|
| 621 |
+
|
| 622 |
+
marker.on("mouseover", function() {
|
| 623 |
+
hoveredMarker = marker;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 624 |
});
|
| 625 |
+
|
| 626 |
+
marker.on("mouseout", function() {
|
| 627 |
+
if (hoveredMarker === marker) {
|
| 628 |
+
hoveredMarker = null;
|
| 629 |
+
}
|
| 630 |
});
|
| 631 |
+
|
| 632 |
+
document.getElementById("marker-icon-url").value = "https://unpkg.com/leaflet@1.9.3/dist/images/marker-icon-2x.png";
|
| 633 |
+
openEditor(marker);
|
| 634 |
+
saveCurrentMapToStorage();
|
| 635 |
+
}
|
| 636 |
+
});
|
| 637 |
+
|
| 638 |
+
// マーカーが変更されたらボタンの状態を更新
|
| 639 |
+
map.on('layeradd layerremove', function() {
|
| 640 |
+
updateEditNextMarkerButton();
|
| 641 |
+
});
|
| 642 |
+
|
| 643 |
+
// ポップアップが開いた時の処理をここに移動
|
| 644 |
+
map.on('popupopen', function(e) {
|
| 645 |
+
const marker = e.popup._source;
|
| 646 |
+
if (nextMarkerEdit) {
|
| 647 |
+
openEditor(marker);
|
| 648 |
+
nextMarkerEdit = false;
|
| 649 |
+
document.getElementById("edit-next-marker").textContent = "次のマーカーを編集";
|
| 650 |
+
document.getElementById("edit-next-marker").classList.remove("danger");
|
| 651 |
+
document.getElementById("edit-next-marker").classList.add("secondary");
|
| 652 |
+
}
|
| 653 |
+
});
|
| 654 |
+
}
|
| 655 |
|
| 656 |
// イベントリスナーの設定
|
| 657 |
function setupEventListeners() {
|
|
|
|
| 1215 |
console.error('コピーに失敗しました:', err);
|
| 1216 |
});
|
| 1217 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1218 |
</script>
|
| 1219 |
</body>
|
| 1220 |
</html>
|