diff --git a/src/map/map.js b/src/map/map.js
index 830717a..07d4e33 100644
--- a/src/map/map.js
+++ b/src/map/map.js
@@ -76,6 +76,7 @@ const sidebarContent = document.getElementById("sidebarContent");
const nodesElement = document.getElementById("nodes");
function dismissPopup(hideMarker) {
+ console.log('dismissing')
if (opened == null) return;
const popup = opened[0];
@@ -97,11 +98,17 @@ function dismissPopup(hideMarker) {
}, 300);
};
+//map.on('popupClose', dismissPopup);
sidebarContent.onclick = dismissPopup;
function onNodeClick(ev, node, clicked) {
console.log('b')
- if (opened != null) return;
+ console.log(opened)
+ if (opened != null) {
+ //if (ev instanceof MouseEvent) return;
+ //dismissPopup();
+ return;
+ }
const rect = clicked.getBoundingClientRect();
nodesElement.style.opacity = 0;
@@ -126,7 +133,7 @@ function onNodeClick(ev, node, clicked) {
sidebarContent.style.backgroundColor = "#111";
opened = [ele, clicked, node];
- ev.stopPropagation();
+ console.log("opened")
}
for (let node of Object.values(nodes)) {
@@ -135,14 +142,26 @@ for (let node of Object.values(nodes)) {
let ele = document.createElement("div");
ele.innerHTML = `${node.city}`;
if (node.description != '') ele.innerHTML += `
${node.description.split('\n')[0]}`;
+
ele.onclick = (ev) => {
marker.openPopup();
map.panTo(node.location, {
padding: [1000, 1000], // TODO I could use this to fix the small screen issue
duration: 0.3
});
- onNodeClick(ev, node, ele);
+ //onNodeClick(ev, node, ele);
+ ev.stopPropagation();
};
+ marker.on('popupopen', (ev) => {
+ console.log(ev)
+ console.log('popened');
+ onNodeClick(ev, node, ele);
+ });
+ marker.on('popupclose', () => {
+ console.log('closed')
+ dismissPopup()
+ });
+
nodesElement.appendChild(ele);
}
@@ -151,6 +170,6 @@ line(de1t, nodes.pl1.location, "de1 - pl1
24ms");
line(de1t, nodes.nl1.location, "de1 - nl1
10ms");
line(nodes.nl1.location, nodes.it1.location, "it1 - nl1
25ms");
-map.on("dragstart", function () {
+/*map.on("dragstart", function () {
dismissPopup(false);
-});
\ No newline at end of file
+});*/
\ No newline at end of file