Add wireframe viewfield marker

(styling marker fill in svg is not currently supported)
This commit is contained in:
Bryan Housel
2017-12-11 15:48:08 -05:00
parent 2edbcc4b82
commit 4b5260a5ab
2 changed files with 20 additions and 1 deletions

View File

@@ -63,6 +63,24 @@ export function svgDefs(context) {
.attr('stroke-width', '0.5px')
.attr('stroke-opacity', '0.75');
defs
.append('marker')
.attr('id', 'viewfield-marker-wireframe')
.attr('viewBox', '0 0 16 16')
.attr('refX', 8)
.attr('refY', 16)
.attr('markerWidth', 4)
.attr('markerHeight', 4)
.attr('markerUnits', 'strokeWidth')
.attr('orient', 'auto')
.append('path')
.attr('class', 'viewfield')
.attr('d', 'M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z')
.attr('fill', 'none')
.attr('stroke', '#fff')
.attr('stroke-width', '0.5px')
.attr('stroke-opacity', '0.75');
// patterns
var patterns = defs.selectAll('pattern')
.data([

View File

@@ -59,6 +59,7 @@ export function svgVertices(projection, context) {
siblings = siblings || {};
var icons = {};
var directions = {};
var wireframe = context.surface().classed('fill-wireframe');
var z = (zoom < 17 ? 0 : zoom < 18 ? 1 : 2);
@@ -197,8 +198,8 @@ export function svgVertices(projection, context) {
.append('path')
.attr('class', 'viewfield')
.attr('d', 'M0,0H0')
.attr('marker-start', 'url(#viewfield-marker)')
.merge(viewfields)
.attr('marker-start', 'url(#viewfield-marker' + (wireframe ? '-wireframe' : '') + ')')
.attr('transform', function(d) { return 'rotate(' + d + ')'; });
}