Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
app.ports.moveMap.subscribe(
town => map.setView([town.latitude, town.longitude], town.defaultZoom)
)

app.ports.addPlaces.subscribe(
places =>
places =>
places.map( place =>
L.marker([place.latitude, place.longitude],
L.marker([place.latitude, place.longitude],
{ icon: L.icon(
{ iconUrl: getMarkerImage({wifi: place.wifi, power: place.power}) }
{ iconUrl: getMarkerImage({wifi: place.wifi, power: place.power}),
iconAnchor: [12, 41]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like these magic number that seems to come from nowhere.
I think a simple solution would be to give them a name (or a single name for the couple ?) by extracting them as variables or constants.
Another one solution could be to compute them from the image (as I guess they represent its center). But that might be overworked (as all icon have the same size and we have no plan to changing them).
An in between solution could be to add a method that, given the size of an image returns the coordinates of the center (but we then have to solve the problem of where does the image size come from :)

So I'll probably start with the first solution and see how it works from here.

)}
)
.addTo(map)
Expand Down