Spaces:
Running
Running
Update index.html
Browse files- index.html +213 -107
index.html
CHANGED
|
@@ -473,6 +473,12 @@
|
|
| 473 |
<button id="save-map-btn" class="hacker-btn secondary">
|
| 474 |
<span class="glow-text">マップを保存</span>
|
| 475 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
<button id="load-map-btn" class="hacker-btn secondary">
|
| 477 |
<span class="glow-text">マップを読み込み</span>
|
| 478 |
</button>
|
|
@@ -580,6 +586,7 @@
|
|
| 580 |
let nextMarkerEdit = false;
|
| 581 |
let markers = [];
|
| 582 |
let currentMapName = '';
|
|
|
|
| 583 |
|
| 584 |
// 初期化処理
|
| 585 |
window.onload = function() {
|
|
@@ -589,70 +596,72 @@
|
|
| 589 |
loading.style.display = 'none';
|
| 590 |
initMap();
|
| 591 |
updateEditNextMarkerButton();
|
|
|
|
| 592 |
}, 1000);
|
| 593 |
|
| 594 |
// イベントリスナーの設定
|
| 595 |
setupEventListeners();
|
| 596 |
};
|
| 597 |
-
// マップ初期化
|
| 598 |
-
function initMap() {
|
| 599 |
-
map = L.map("map").setView([33.321797711641395, 130.52061378343208], 16);
|
| 600 |
-
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
| 601 |
-
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors'
|
| 602 |
-
}).addTo(map);
|
| 603 |
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
|
|
|
| 609 |
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 625 |
});
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
map.on('layeradd layerremove', function() {
|
| 641 |
-
updateEditNextMarkerButton();
|
| 642 |
-
});
|
| 643 |
-
|
| 644 |
-
// ポップアップが開いた時の処理をここに移動
|
| 645 |
-
map.on('popupopen', function(e) {
|
| 646 |
-
const marker = e.popup._source;
|
| 647 |
-
if (nextMarkerEdit) {
|
| 648 |
-
openEditor(marker);
|
| 649 |
-
nextMarkerEdit = false;
|
| 650 |
-
document.getElementById("edit-next-marker").textContent = "次のマーカーを編集";
|
| 651 |
-
document.getElementById("edit-next-marker").classList.remove("danger");
|
| 652 |
-
document.getElementById("edit-next-marker").classList.add("secondary");
|
| 653 |
-
}
|
| 654 |
-
});
|
| 655 |
-
}
|
| 656 |
|
| 657 |
// イベントリスナーの設定
|
| 658 |
function setupEventListeners() {
|
|
@@ -678,6 +687,8 @@ function initMap() {
|
|
| 678 |
|
| 679 |
// マップ保存/読み込み関連
|
| 680 |
document.getElementById("save-map-btn").addEventListener("click", showSaveMapModal);
|
|
|
|
|
|
|
| 681 |
document.getElementById("load-map-btn").addEventListener("click", showGallery);
|
| 682 |
document.getElementById("confirm-save-map").addEventListener("click", saveCurrentMapWithName);
|
| 683 |
document.getElementById("cancel-save-map").addEventListener("click", hideSaveMapModal);
|
|
@@ -691,6 +702,90 @@ function initMap() {
|
|
| 691 |
document.getElementById("copyButton").onclick = copyHTMLToClipboard;
|
| 692 |
}
|
| 693 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
// マーカー編集モードのトグル
|
| 695 |
function toggleEditNextMarkerMode() {
|
| 696 |
if (nextMarkerEdit) {
|
|
@@ -980,9 +1075,11 @@ function initMap() {
|
|
| 980 |
}
|
| 981 |
|
| 982 |
// マップ名を付けて保存
|
| 983 |
-
function saveCurrentMapWithName() {
|
| 984 |
-
const
|
| 985 |
-
|
|
|
|
|
|
|
| 986 |
alert("マップ名を入力してください");
|
| 987 |
return;
|
| 988 |
}
|
|
@@ -1010,13 +1107,15 @@ function initMap() {
|
|
| 1010 |
});
|
| 1011 |
|
| 1012 |
const savedMaps = JSON.parse(localStorage.getItem('savedMaps')) || {};
|
| 1013 |
-
savedMaps[
|
| 1014 |
localStorage.setItem('savedMaps', JSON.stringify(savedMaps));
|
| 1015 |
|
| 1016 |
-
currentMapName =
|
| 1017 |
-
|
|
|
|
| 1018 |
hideSaveMapModal();
|
| 1019 |
-
|
|
|
|
| 1020 |
}
|
| 1021 |
|
| 1022 |
// マップギャラリーを表示
|
|
@@ -1075,56 +1174,58 @@ function initMap() {
|
|
| 1075 |
}
|
| 1076 |
|
| 1077 |
// ギャラリーからマップを読み込み
|
| 1078 |
-
function loadMapFromGallery(mapName) {
|
| 1079 |
-
|
| 1080 |
-
|
| 1081 |
-
|
| 1082 |
-
if (!mapData) {
|
| 1083 |
-
alert("マップデータが見つかりません");
|
| 1084 |
-
return;
|
| 1085 |
-
}
|
| 1086 |
-
|
| 1087 |
-
// 現在のマップをクリア
|
| 1088 |
-
clearCurrentMap();
|
| 1089 |
-
|
| 1090 |
-
// 新しいマップを読み込み
|
| 1091 |
-
map.setView(mapData.center, mapData.zoom);
|
| 1092 |
-
currentMapName = mapName; // 現在のマップ名を更新
|
| 1093 |
-
|
| 1094 |
-
// マーカーを追加
|
| 1095 |
-
mapData.markers.forEach((markerData) => {
|
| 1096 |
-
const icon = L.icon({
|
| 1097 |
-
iconUrl: markerData.iconUrl,
|
| 1098 |
-
iconSize: markerData.iconSize,
|
| 1099 |
-
iconAnchor: [markerData.iconSize[0] / 2, markerData.iconSize[1]],
|
| 1100 |
-
popupAnchor: [0, -markerData.iconSize[1]],
|
| 1101 |
-
tooltipAnchor: [markerData.iconSize[0] / 2, -markerData.iconSize[1] / 2],
|
| 1102 |
-
});
|
| 1103 |
|
| 1104 |
-
|
| 1105 |
-
|
| 1106 |
-
|
|
|
|
| 1107 |
|
| 1108 |
-
|
| 1109 |
-
|
| 1110 |
-
});
|
| 1111 |
|
| 1112 |
-
|
| 1113 |
-
|
| 1114 |
-
|
| 1115 |
-
|
| 1116 |
-
|
| 1117 |
-
});
|
| 1118 |
|
| 1119 |
-
|
| 1120 |
-
|
| 1121 |
-
|
| 1122 |
-
|
| 1123 |
-
|
| 1124 |
-
|
| 1125 |
-
|
| 1126 |
-
|
| 1127 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1128 |
|
| 1129 |
// ギャラリーからマップを削除
|
| 1130 |
function deleteMapFromGallery(mapName) {
|
|
@@ -1136,6 +1237,11 @@ function loadMapFromGallery(mapName) {
|
|
| 1136 |
currentMapName = '';
|
| 1137 |
}
|
| 1138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1139 |
showGallery(); // ギャラリーを更新
|
| 1140 |
}
|
| 1141 |
|
|
|
|
| 473 |
<button id="save-map-btn" class="hacker-btn secondary">
|
| 474 |
<span class="glow-text">マップを保存</span>
|
| 475 |
</button>
|
| 476 |
+
<button id="overwrite-current-map-btn" class="hacker-btn secondary disabled">
|
| 477 |
+
<span class="glow-text">(開いたマップ名)を置き換えて保存</span>
|
| 478 |
+
</button>
|
| 479 |
+
<button id="overwrite-map-btn" class="hacker-btn secondary">
|
| 480 |
+
<span class="glow-text">置き換えて保存</span>
|
| 481 |
+
</button>
|
| 482 |
<button id="load-map-btn" class="hacker-btn secondary">
|
| 483 |
<span class="glow-text">マップを読み込み</span>
|
| 484 |
</button>
|
|
|
|
| 586 |
let nextMarkerEdit = false;
|
| 587 |
let markers = [];
|
| 588 |
let currentMapName = '';
|
| 589 |
+
let lastOpenedMapName = '';
|
| 590 |
|
| 591 |
// 初期化処理
|
| 592 |
window.onload = function() {
|
|
|
|
| 596 |
loading.style.display = 'none';
|
| 597 |
initMap();
|
| 598 |
updateEditNextMarkerButton();
|
| 599 |
+
updateOverwriteCurrentMapButton();
|
| 600 |
}, 1000);
|
| 601 |
|
| 602 |
// イベントリスナーの設定
|
| 603 |
setupEventListeners();
|
| 604 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 605 |
|
| 606 |
+
// マップ初期化
|
| 607 |
+
function initMap() {
|
| 608 |
+
map = L.map("map").setView([33.321797711641395, 130.52061378343208], 16);
|
| 609 |
+
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
| 610 |
+
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors'
|
| 611 |
+
}).addTo(map);
|
| 612 |
|
| 613 |
+
// マーカーイベントの設定
|
| 614 |
+
map.on("click", function(e) {
|
| 615 |
+
if (nextMarkerEdit) {
|
| 616 |
+
return;
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
if (editingMarker) {
|
| 620 |
+
const latlng = e.latlng;
|
| 621 |
+
editingMarker.setLatLng([latlng.lat, latlng.lng]);
|
| 622 |
+
document.getElementById("marker-lat").value = latlng.lat;
|
| 623 |
+
document.getElementById("marker-lng").value = latlng.lng;
|
| 624 |
+
updatePreviewSize();
|
| 625 |
+
saveCurrentMapToStorage();
|
| 626 |
+
} else {
|
| 627 |
+
const latlng = e.latlng;
|
| 628 |
+
const marker = L.marker(latlng).addTo(map);
|
| 629 |
+
marker.bindPopup("新しいマーカーのポップアップ");
|
| 630 |
+
marker.bindTooltip("新しいマーカーのツールチップ");
|
| 631 |
+
|
| 632 |
+
marker.on("mouseover", function() {
|
| 633 |
+
hoveredMarker = marker;
|
| 634 |
+
});
|
| 635 |
+
|
| 636 |
+
marker.on("mouseout", function() {
|
| 637 |
+
if (hoveredMarker === marker) {
|
| 638 |
+
hoveredMarker = null;
|
| 639 |
+
}
|
| 640 |
+
});
|
| 641 |
+
|
| 642 |
+
document.getElementById("marker-icon-url").value = "https://unpkg.com/leaflet@1.9.3/dist/images/marker-icon-2x.png";
|
| 643 |
+
openEditor(marker);
|
| 644 |
+
saveCurrentMapToStorage();
|
| 645 |
+
}
|
| 646 |
});
|
| 647 |
+
|
| 648 |
+
// マーカーが変更されたらボタンの状態を更新
|
| 649 |
+
map.on('layeradd layerremove', function() {
|
| 650 |
+
updateEditNextMarkerButton();
|
| 651 |
+
});
|
| 652 |
+
|
| 653 |
+
// ポップアップが開いた時の処理をここに移動
|
| 654 |
+
map.on('popupopen', function(e) {
|
| 655 |
+
const marker = e.popup._source;
|
| 656 |
+
if (nextMarkerEdit) {
|
| 657 |
+
openEditor(marker);
|
| 658 |
+
nextMarkerEdit = false;
|
| 659 |
+
document.getElementById("edit-next-marker").textContent = "次のマーカーを編集";
|
| 660 |
+
document.getElementById("edit-next-marker").classList.remove("danger");
|
| 661 |
+
document.getElementById("edit-next-marker").classList.add("secondary");
|
| 662 |
}
|
| 663 |
});
|
| 664 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 665 |
|
| 666 |
// イベントリスナーの設定
|
| 667 |
function setupEventListeners() {
|
|
|
|
| 687 |
|
| 688 |
// マップ保存/読み込み関連
|
| 689 |
document.getElementById("save-map-btn").addEventListener("click", showSaveMapModal);
|
| 690 |
+
document.getElementById("overwrite-current-map-btn").addEventListener("click", overwriteCurrentMap);
|
| 691 |
+
document.getElementById("overwrite-map-btn").addEventListener("click", showGalleryForOverwrite);
|
| 692 |
document.getElementById("load-map-btn").addEventListener("click", showGallery);
|
| 693 |
document.getElementById("confirm-save-map").addEventListener("click", saveCurrentMapWithName);
|
| 694 |
document.getElementById("cancel-save-map").addEventListener("click", hideSaveMapModal);
|
|
|
|
| 702 |
document.getElementById("copyButton").onclick = copyHTMLToClipboard;
|
| 703 |
}
|
| 704 |
|
| 705 |
+
// 現在のマップを置き換えボタンの状態を更新
|
| 706 |
+
function updateOverwriteCurrentMapButton() {
|
| 707 |
+
const btn = document.getElementById("overwrite-current-map-btn");
|
| 708 |
+
if (lastOpenedMapName) {
|
| 709 |
+
btn.classList.remove("disabled");
|
| 710 |
+
btn.innerHTML = `<span class="glow-text">「${lastOpenedMapName}」を置き換えて保存</span>`;
|
| 711 |
+
} else {
|
| 712 |
+
btn.classList.add("disabled");
|
| 713 |
+
btn.innerHTML = `<span class="glow-text">(開いたマップ名)を置き換えて保存</span>`;
|
| 714 |
+
}
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
// 現在開いているマップを置き換えて保存
|
| 718 |
+
function overwriteCurrentMap() {
|
| 719 |
+
if (!lastOpenedMapName) {
|
| 720 |
+
alert("置き換えるマップがありません");
|
| 721 |
+
return;
|
| 722 |
+
}
|
| 723 |
+
|
| 724 |
+
if (confirm(`マップ「${lastOpenedMapName}」を現在の内容で置き換えますか?`)) {
|
| 725 |
+
saveCurrentMapWithName(lastOpenedMapName);
|
| 726 |
+
}
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
// 置き換え用のマップギャラリーを表示
|
| 730 |
+
function showGalleryForOverwrite() {
|
| 731 |
+
const gallery = document.getElementById("gallery-container");
|
| 732 |
+
const mapList = document.getElementById("gallery-map-list");
|
| 733 |
+
mapList.innerHTML = "";
|
| 734 |
+
|
| 735 |
+
const savedMaps = JSON.parse(localStorage.getItem('savedMaps')) || {};
|
| 736 |
+
|
| 737 |
+
if (Object.keys(savedMaps).length === 0) {
|
| 738 |
+
mapList.innerHTML = '<div class="text-center py-4">保存されたマップはありません</div>';
|
| 739 |
+
} else {
|
| 740 |
+
for (const [name, data] of Object.entries(savedMaps)) {
|
| 741 |
+
const mapItem = document.createElement("div");
|
| 742 |
+
mapItem.className = "gallery-map-item";
|
| 743 |
+
|
| 744 |
+
mapItem.innerHTML = `
|
| 745 |
+
<div class="gallery-map-title">${name}</div>
|
| 746 |
+
<div class="gallery-map-preview">
|
| 747 |
+
マーカー数: ${data.markers.length}<br>
|
| 748 |
+
中心座標: ${data.center.lat.toFixed(4)}, ${data.center.lng.toFixed(4)}<br>
|
| 749 |
+
ズームレベル: ${data.zoom}
|
| 750 |
+
</div>
|
| 751 |
+
<div class="gallery-map-actions">
|
| 752 |
+
<button class="hacker-btn gallery-btn load-map-btn" data-name="${name}">読み込み</button>
|
| 753 |
+
<button class="hacker-btn gallery-btn secondary overwrite-map-btn" data-name="${name}">このマップを置き換え</button>
|
| 754 |
+
<button class="hacker-btn gallery-btn danger delete-map-btn" data-name="${name}">削除</button>
|
| 755 |
+
</div>
|
| 756 |
+
`;
|
| 757 |
+
|
| 758 |
+
mapList.appendChild(mapItem);
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
// イベントリスナーを追加
|
| 762 |
+
document.querySelectorAll('.load-map-btn').forEach(btn => {
|
| 763 |
+
btn.addEventListener('click', function() {
|
| 764 |
+
loadMapFromGallery(this.dataset.name);
|
| 765 |
+
});
|
| 766 |
+
});
|
| 767 |
+
|
| 768 |
+
document.querySelectorAll('.overwrite-map-btn').forEach(btn => {
|
| 769 |
+
btn.addEventListener('click', function() {
|
| 770 |
+
if (confirm(`マップ「${this.dataset.name}」を現在の内容で置き換えますか?`)) {
|
| 771 |
+
saveCurrentMapWithName(this.dataset.name);
|
| 772 |
+
hideGallery();
|
| 773 |
+
}
|
| 774 |
+
});
|
| 775 |
+
});
|
| 776 |
+
|
| 777 |
+
document.querySelectorAll('.delete-map-btn').forEach(btn => {
|
| 778 |
+
btn.addEventListener('click', function() {
|
| 779 |
+
if (confirm(`マップ「${this.dataset.name}」を削除しますか?`)) {
|
| 780 |
+
deleteMapFromGallery(this.dataset.name);
|
| 781 |
+
}
|
| 782 |
+
});
|
| 783 |
+
});
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
gallery.style.display = "block";
|
| 787 |
+
}
|
| 788 |
+
|
| 789 |
// マーカー編集モードのトグル
|
| 790 |
function toggleEditNextMarkerMode() {
|
| 791 |
if (nextMarkerEdit) {
|
|
|
|
| 1075 |
}
|
| 1076 |
|
| 1077 |
// マップ名を付けて保存
|
| 1078 |
+
function saveCurrentMapWithName(mapName = null) {
|
| 1079 |
+
const mapNameInput = document.getElementById("save-map-name");
|
| 1080 |
+
const name = mapName || mapNameInput.value.trim();
|
| 1081 |
+
|
| 1082 |
+
if (!name) {
|
| 1083 |
alert("マップ名を入力してください");
|
| 1084 |
return;
|
| 1085 |
}
|
|
|
|
| 1107 |
});
|
| 1108 |
|
| 1109 |
const savedMaps = JSON.parse(localStorage.getItem('savedMaps')) || {};
|
| 1110 |
+
savedMaps[name] = mapData;
|
| 1111 |
localStorage.setItem('savedMaps', JSON.stringify(savedMaps));
|
| 1112 |
|
| 1113 |
+
currentMapName = name;
|
| 1114 |
+
lastOpenedMapName = name;
|
| 1115 |
+
mapNameInput.value = "";
|
| 1116 |
hideSaveMapModal();
|
| 1117 |
+
updateOverwriteCurrentMapButton();
|
| 1118 |
+
alert(`マップ「${name}」を保存しました`);
|
| 1119 |
}
|
| 1120 |
|
| 1121 |
// マップギャラリーを表示
|
|
|
|
| 1174 |
}
|
| 1175 |
|
| 1176 |
// ギャラリーからマップを読み込み
|
| 1177 |
+
function loadMapFromGallery(mapName) {
|
| 1178 |
+
const savedMaps = JSON.parse(localStorage.getItem('savedMaps')) || {};
|
| 1179 |
+
const mapData = savedMaps[mapName];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1180 |
|
| 1181 |
+
if (!mapData) {
|
| 1182 |
+
alert("マップデータが見つかりません");
|
| 1183 |
+
return;
|
| 1184 |
+
}
|
| 1185 |
|
| 1186 |
+
// 現在のマップをクリア
|
| 1187 |
+
clearCurrentMap();
|
|
|
|
| 1188 |
|
| 1189 |
+
// 新しいマップを読み込み
|
| 1190 |
+
map.setView(mapData.center, mapData.zoom);
|
| 1191 |
+
currentMapName = mapName;
|
| 1192 |
+
lastOpenedMapName = mapName; // 最後に開いたマップ名を更新
|
| 1193 |
+
updateOverwriteCurrentMapButton();
|
|
|
|
| 1194 |
|
| 1195 |
+
// マーカーを追加
|
| 1196 |
+
mapData.markers.forEach((markerData) => {
|
| 1197 |
+
const icon = L.icon({
|
| 1198 |
+
iconUrl: markerData.iconUrl,
|
| 1199 |
+
iconSize: markerData.iconSize,
|
| 1200 |
+
iconAnchor: [markerData.iconSize[0] / 2, markerData.iconSize[1]],
|
| 1201 |
+
popupAnchor: [0, -markerData.iconSize[1]],
|
| 1202 |
+
tooltipAnchor: [markerData.iconSize[0] / 2, -markerData.iconSize[1] / 2],
|
| 1203 |
+
});
|
| 1204 |
+
|
| 1205 |
+
const marker = L.marker([markerData.lat, markerData.lng], { icon: icon }).addTo(map);
|
| 1206 |
+
if (markerData.popupContent) marker.bindPopup(markerData.popupContent);
|
| 1207 |
+
if (markerData.tooltipContent) marker.bindTooltip(markerData.tooltipContent);
|
| 1208 |
+
|
| 1209 |
+
marker.on("mouseover", function() {
|
| 1210 |
+
hoveredMarker = marker;
|
| 1211 |
+
});
|
| 1212 |
+
|
| 1213 |
+
marker.on("mouseout", function() {
|
| 1214 |
+
if (hoveredMarker === marker) {
|
| 1215 |
+
hoveredMarker = null;
|
| 1216 |
+
}
|
| 1217 |
+
});
|
| 1218 |
+
});
|
| 1219 |
+
|
| 1220 |
+
// 保存フォームにマップ名をセット
|
| 1221 |
+
document.getElementById("save-map-name").value = currentMapName;
|
| 1222 |
+
|
| 1223 |
+
// ユーザーに通知
|
| 1224 |
+
alert(`マップ「${mapName}」を読み込みました`);
|
| 1225 |
+
|
| 1226 |
+
hideGallery();
|
| 1227 |
+
updateEditNextMarkerButton();
|
| 1228 |
+
}
|
| 1229 |
|
| 1230 |
// ギャラリーからマップを削除
|
| 1231 |
function deleteMapFromGallery(mapName) {
|
|
|
|
| 1237 |
currentMapName = '';
|
| 1238 |
}
|
| 1239 |
|
| 1240 |
+
if (lastOpenedMapName === mapName) {
|
| 1241 |
+
lastOpenedMapName = '';
|
| 1242 |
+
updateOverwriteCurrentMapButton();
|
| 1243 |
+
}
|
| 1244 |
+
|
| 1245 |
showGallery(); // ギャラリーを更新
|
| 1246 |
}
|
| 1247 |
|