publiclab / leaflet-blurred-location-display

A library to display points which have been "blurred" for privacy with leaflet-blurred-location
https://publiclab.github.io/leaflet-blurred-location-display/examples/index.html
GNU General Public License v3.0
11 stars 12 forks source link

Make getVisibleLocations() . #67

Open sagarpreet-chadha opened 5 years ago

sagarpreet-chadha commented 5 years ago

locations_markers_array - maybe we should rename this getVisibleLocations()? SourceUrl_markers_array is this the same as above but for remote locations? What if we instead just added a property to each location like source: 'remote' and then only used the above getVisibleLocations(); method instead of having 2?

@jywarren , To make code more modular --- we have implemented separate listeners (panning and zooming) for Local data and Remote data , hence we have made separate arrays - locations_markers_array and SourceUrl_markers_array in order to avoid Race Condition between the different listeners .

Hence we have these 2 functions that are useful :

https://github.com/publiclab/leaflet-blurred-location-display/blob/86650cf65980d643e97dba0092a32f1a582db7d2/src/blurredLocationDisplay.js#L163

https://github.com/publiclab/leaflet-blurred-location-display/blob/86650cf65980d643e97dba0092a32f1a582db7d2/src/blurredLocationDisplay.js#L167

We can make a function getVisibleLocations() which basically combines the data from these 2 arrays and returns it in the form :

Screenshot 2019-04-07 at 4 54 05 PM

Now for all future purposes , we can use only this function . What do you think ?

jywarren commented 5 years ago

Oh that sounds great. Yes, I like the idea of internal separation that is opaque in the external API!

On Sun, Apr 7, 2019, 7:33 AM Sagarpreet Chadha notifications@github.com wrote:

locations_markers_array - maybe we should rename this getVisibleLocations()? SourceUrl_markers_array is this the same as above but for remote locations? What if we instead just added a property to each location like source: 'remote' and then only used the above getVisibleLocations(); method instead of having 2?

@jywarren https://github.com/jywarren , To make code more modular --- we have implemented separate listeners (panning and zooming) for Local data and Remote data , hence we have made separate arrays - locations_markers_array and SourceUrl_markers_array in order to avoid Race Condition between the different listeners .

We can make a function getVisibleLocations() which basically combines the data from these 2 arrays and returns it in the form :

[image: Screenshot 2019-04-07 at 4 54 05 PM] https://user-images.githubusercontent.com/14952645/55682874-b0d02000-5956-11e9-974f-e1eca93f9271.png

Now for all future purposes , we can use only this function . What do you think ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/leaflet-blurred-location-display/issues/67, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ8UHpddbRV6tCSJJ9OYagD2IM3zdks5veddwgaJpZM4cgtPU .