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');
}

View File

@@ -1,3 +1,5 @@
$event_default: red;
$offwhite: #efefef;
$midwhite: #a0a0a0;
$darkwhite: darken($midwhite, 15%);

View File

@@ -30,7 +30,7 @@
z-index: $map;
}
.event {
fill: $yellow;
fill: $event_default;
cursor: pointer;
opacity: 0.45;
}
@@ -144,6 +144,7 @@
*/
.location-event-marker {
fill: $event_default;
stroke-width: 0;
transition: 0.2s ease;
fill-opacity: 0.8;

View File

@@ -177,6 +177,7 @@
}
.event {
fill: $event_default;
cursor: pointer;
opacity: .7;

View File

@@ -84,10 +84,16 @@ const initial = {
palette: d3.schemeCategory10,
narratives: {
narrative_1: {
default: {
style: 'dotted', // ['dotted', 'solid']
opacity: 0.4, // range between 0 and 1
stroke: '#ffffff', // Any hex or rgb code
stroke: 'red', // Any hex or rgb code
strokeWidth: 2
},
narrative_1: {
style: 'solid', // ['dotted', 'solid']
opacity: 0.4, // range between 0 and 1
stroke: 'red', // Any hex or rgb code
strokeWidth: 2
}
}