Skip to content

Commit

Permalink
add url and title to marker object
Browse files Browse the repository at this point in the history
  • Loading branch information
daemon1024 committed Aug 17, 2021
1 parent e1dc93b commit 286dd39
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions dist/Leaflet.BlurredLocationDisplay.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/blurredLocationDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ BlurredLocationDisplay = function BlurredLocationDisplay(options) {
return parsed_data ;
}

var all_markers_map = new Map() ; // passed to gridCenterRectangle --- contains all markers fetched till now !
var all_markers_map = new Map() ; // passed to gridCenterRectangle --- contains all markers fetched till now !
var locations_markers_array = [] ;
var SourceUrl_markers_array = [] ; // contains currently visible markers on map only !
var SourceUrl_id_map = new Map() ; // separate hash map because 'ids' of locations_markers and SourceURL array may be same .
Expand Down Expand Up @@ -151,6 +151,7 @@ BlurredLocationDisplay = function BlurredLocationDisplay(options) {

var id = obj["id"] ;
var url = obj["url"] ;
var title = obj["title"] ;
var latitude = obj["latitude"] ;
var longitude = obj["longitude"] ;

Expand All @@ -164,6 +165,8 @@ BlurredLocationDisplay = function BlurredLocationDisplay(options) {
var m = L.marker([latitude, longitude], {
icon: icon_color
}) ;
m.title = title;
m.url = url;
SourceUrl_id_map.set(id , m) ;
all_markers_map.set(id , m) ;
if(options.style === 'markers' || options.style === 'both'){
Expand Down
5 changes: 2 additions & 3 deletions src/ui/gridCenterRectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ module.exports = function changeRectangleColor(options){

locations.forEach(function(value , key , map){
if(typeof(value._latlng) != "undefined"){
let latitude = value._latlng.lat ;
// console.log(latitude) ;
let latitude = value._latlng.lat ;
let longitude = value._latlng.lng ;
if(latitude >= bounds[0][0] && latitude <= bounds[1][0] && longitude >= bounds[0][1] && longitude <= bounds[1][1]){
markers.push(value) ;
Expand All @@ -78,7 +77,7 @@ module.exports = function changeRectangleColor(options){
if (markers[0].hasOwnProperty('url') && markers[0].hasOwnProperty('url')) {
markers.forEach(function(marker) {
if (marker.hasOwnProperty('url') && marker.hasOwnProperty('url')) {
popupContents += "<li><a href='" + marker.url + "'>@" + marker.title + "</a></li>";
popupContents += "<li><a href='https://publiclab.org" + marker.url + "'>@" + marker.title + "</a></li>";
}
});
} else {
Expand Down

0 comments on commit 286dd39

Please sign in to comment.