Skip to content

Commit

Permalink
hiding both info windows when one is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
emre2038 authored and milafrerichs committed Jan 26, 2021
1 parent 6b19f20 commit 6cc8c20
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 11 additions & 3 deletions src/js/map/point_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let facilityRowItem = null;
let activeMarkers = [];
let activePoints = []; //the visible points on the map

const POPUP_OFFSET= [20, 0];
const POPUP_OFFSET = [20, 0];

/**
* this class creates the point data dialog
Expand All @@ -47,7 +47,7 @@ export class PointData extends Observable {
tooltipRowItem = $('.' + tooltipRowClsName)[0].cloneNode(true);
facilityRowItem = $('.' + facilityRowClsName)[0].cloneNode(true);
facilityItem = $('.' + facilityClsName);
$('.facility-info__close').on('click', () => this.hideFacilityModal());
$('.facility-info__close').on('click', () => this.hideInfoWindows());
}

genLayer() {
Expand Down Expand Up @@ -191,7 +191,10 @@ export class PointData extends Observable {
popup
.setLatLng({lat: point.y, lng: point.x})
.setContent(popupContent)
.addTo(this.map);
.addTo(this.map)
.on('remove', () => {
this.hideInfoWindows();
});
this.triggerEvent('point_data.load_popup.clicked', eventLabel);
} else {
popup
Expand All @@ -204,6 +207,11 @@ export class PointData extends Observable {
setPopupStyle('facility-tooltip');
}

hideInfoWindows = () => {
this.hideFacilityModal();
$('a.leaflet-popup-close-button')[0].click()
}

hideMarkerPopup = () => {
this.map.closePopup();
this.map.map_variables.popup = null;
Expand Down
5 changes: 3 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1517,8 +1517,9 @@ adler-32@~1.2.0:
printj "~1.1.0"

ajv-keywords@^3.5.2:
version "3.5.1"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.1.tgz#b83ca89c5d42d69031f424cad49aada0236c6957"
version "3.5.2"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d"
integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==

ajv@^6.12.3, ajv@^6.12.4:
version "6.12.6"
Expand Down

0 comments on commit 6cc8c20

Please sign in to comment.