fall back on a default red styling for narratives

This commit is contained in:
Lachie Kermode
2018-11-30 14:46:44 +00:00
parent 70dbcd96e0
commit a2d5fdf3da
5 changed files with 20 additions and 6 deletions

View File

@@ -357,22 +357,26 @@ Stop and start the development process in terminal after you have added your tok
.exit()
.remove();
let styleName
narrativesDom
.enter().append('path')
.attr('class', 'narrative')
.attr('d', sequenceLine)
.style('stroke-width', d => {
styleName = d[0].narrative && d[0].narrative in narrativeProps
? d[0].narrative
: 'default'
const n = d[0].narrative;
return (n) ? narrativeProps[n].strokeWidth : 3;
return (n) ? narrativeProps[styleName].strokeWidth : 3;
})
.style('stroke-dasharray', d => {
const n = d[0].narrative;
if (narrativeProps[n].style === 'dotted') return "2px 5px";
if (narrativeProps[styleName].style === 'dotted') return "2px 5px";
return 'none';
})
.style('stroke', d => {
const n = d[0].narrative;
return (n) ? narrativeProps[n].stroke : '#fff';
return (n) ? narrativeProps[styleName].stroke : '#fff';
})
.style('fill', 'none');
}