From 9d1915af786379446ac7465215b6f3679f270e19 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 30 Mar 2019 18:50:32 +0100 Subject: map scroll --- client/map/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'client/map/index.js') diff --git a/client/map/index.js b/client/map/index.js index a1c728d9..9ca43867 100644 --- a/client/map/index.js +++ b/client/map/index.js @@ -52,12 +52,12 @@ function addMarker(map, latlng, citations) { rec.unshift("") rec.push("") } - const addressString = addresses.map(addr => addr.name).join('
') - rec.push("
") - rec.push(addressString) if (year) { rec.push(" (" + year + ")") } + const addressString = addresses.map(addr => addr.name).join('
') + rec.push("
") + rec.push(addressString) return rec.join("") }) @@ -107,6 +107,7 @@ export default function append(el, payload) { console.log(citation) return } + console.log(citation) citation.addresses.forEach(address => { if (!(address.name in citationsByAddress)) { citationsByAddress[address.name] = { address, citations: []} @@ -122,7 +123,16 @@ export default function append(el, payload) { const latlng = [citationAddress.lat, citationAddress.lng].map(n => parseFloat(n)) if (Number.isNaN(latlng[0]) || Number.isNaN(latlng[1])) return addMarker(map, latlng, citationList) - addArc(map, source, latlng, arcStyles[citationAddress.type]) + const style = { ...arcStyles[citationAddress.type] } + let weight = Math.min(citationList.length, 5) + let opacity = 0.5 + Math.min(citationList.length / 5, 0.5) + if (citationAddress.type !== 'edu') { + weight += 1 + opacity = 1 + } + style.weight = String(weight) + style.opacity = opacity + addArc(map, source, latlng, style) }) console.log(paper) -- cgit v1.2.3-70-g09d2