Spaces:
Running
Running
Update index.html
Browse files- index.html +26 -30
index.html
CHANGED
|
@@ -500,12 +500,8 @@ document.getElementById("edit-next-marker").addEventListener("click", function()
|
|
| 500 |
alert("次にクリックするマーカーを編集します。");
|
| 501 |
});
|
| 502 |
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
map.on("click", function(e) { // ★修正箇所
|
| 507 |
-
|
| 508 |
-
if (nextMarkerEdit) {
|
| 509 |
const clickedMarkers = [];
|
| 510 |
map.eachLayer(function (layer) {
|
| 511 |
if (layer instanceof L.Marker) {
|
|
@@ -521,30 +517,30 @@ document.getElementById("edit-next-marker").addEventListener("click", function()
|
|
| 521 |
}
|
| 522 |
nextMarkerEdit = false;
|
| 523 |
} else {
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
|
| 549 |
// マーカー移動時にも保存
|
| 550 |
map.on("markerdragend", function(e) {
|
|
|
|
| 500 |
alert("次にクリックするマーカーを編集します。");
|
| 501 |
});
|
| 502 |
|
| 503 |
+
map.on("click", function(e) {
|
| 504 |
+
if (nextMarkerEdit) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 505 |
const clickedMarkers = [];
|
| 506 |
map.eachLayer(function (layer) {
|
| 507 |
if (layer instanceof L.Marker) {
|
|
|
|
| 517 |
}
|
| 518 |
nextMarkerEdit = false;
|
| 519 |
} else {
|
| 520 |
+
// 既存のクリックイベント処理
|
| 521 |
+
if (editingMarker) {
|
| 522 |
+
const t = e.latlng;
|
| 523 |
+
editingMarker.setLatLng([t.lat, t.lng]);
|
| 524 |
+
document.getElementById("marker-lat").value = t.lat;
|
| 525 |
+
document.getElementById("marker-lng").value = t.lng;
|
| 526 |
+
updatePreviewSize();
|
| 527 |
+
saveMapToStorage();
|
| 528 |
+
} else {
|
| 529 |
+
const t = e.latlng;
|
| 530 |
+
const n = L.marker(t).addTo(map);
|
| 531 |
+
n.bindPopup("新しいマーカー");
|
| 532 |
+
n.bindTooltip("新しいマーカーのツールチップ");
|
| 533 |
+
n.on("mouseover", function() {
|
| 534 |
+
hoveredMarker = n;
|
| 535 |
+
});
|
| 536 |
+
n.on("mouseout", function() {
|
| 537 |
+
hoveredMarker === n && (hoveredMarker = null);
|
| 538 |
+
});
|
| 539 |
+
openEditor(n);
|
| 540 |
+
saveMapToStorage();
|
| 541 |
+
}
|
| 542 |
+
}
|
| 543 |
+
});
|
| 544 |
|
| 545 |
// マーカー移動時にも保存
|
| 546 |
map.on("markerdragend", function(e) {
|