summaryrefslogtreecommitdiff
path: root/client/map/index.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-12-17 17:47:37 +0100
committerJules Laplace <julescarbon@gmail.com>2018-12-17 17:47:37 +0100
commit7eb2b4509802388f2fe980a3477dad006cf81016 (patch)
tree7e77ff97e62be2a3fc1c53638e1b5211d32133e9 /client/map/index.js
parent6a6af799c528e7d2c865db75757e90cd921f85ae (diff)
fix map
Diffstat (limited to 'client/map/index.js')
-rw-r--r--client/map/index.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/client/map/index.js b/client/map/index.js
index 788894f9..053cf13b 100644
--- a/client/map/index.js
+++ b/client/map/index.js
@@ -34,6 +34,7 @@ function addMarker(map, latlng, title, subtext) {
subtext,
].join(''))
}
+
function addArc(map, src, dest) {
L.bezier({
path: [
@@ -46,14 +47,15 @@ function addArc(map, src, dest) {
}
export default function append(el, payload) {
- const { cmd, data } = payload
+ const { data } = payload
+ let { paper, address } = data
+ let source = [0, 0]
const citations = getCitations(data)
- // console.log(el)
let map = L.map(el).setView([25, 0], 2)
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
- attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors,' +
- '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>,' +
+ attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
+ '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox.dark',
@@ -61,13 +63,8 @@ export default function append(el, payload) {
accessToken: 'pk.eyJ1IjoiZmFuc2FsY3kiLCJhIjoiY2pvN3I1czJwMHF5NDNrbWRoMWpteHlrdCJ9.kMpM5syQUhVjKkn1iVx9fg'
}).addTo(map)
- let { address } = data
- console.log(address)
- let source = [0, 0]
if (address) {
source = address.slice(3, 5).map(n => parseFloat(n))
- // console.log(map, address, source)
- console.log(source)
}
citations.forEach(point => {
@@ -77,5 +74,5 @@ export default function append(el, payload) {
addArc(map, source, latlng)
})
- addMarker(map, source, document.querySelector('h2').innerText, address[0])
+ addMarker(map, source, paper.title, paper.address)
}