Layers for nodes added

This commit is contained in:
Piotr Pekala 2019-10-17 07:35:22 -07:00
parent c01ad75457
commit 87454fd7ed

View File

@ -42,10 +42,35 @@ export class NodeWidget implements Widget {
this.nodesEventSource.clicked.emit(new ClickedDataEvent<MapNode>(node, event.pageX, event.pageY));
});
node_body_merge.select('.layer_label_wrapper').remove();
node_body_merge
.append<SVGRectElement>('rect')
.attr('class', 'layer_label_wrapper')
.attr('width', '26')
.attr('height', '26')
.attr('x', (n: MapNode) => n.width/2 - 13)
.attr('y', (n: MapNode) => n.height/2 - 13)
.attr('fill', 'red');
node_body_merge.select('.layer_label').remove();
node_body_merge
.append<SVGTextElement>('text')
.attr('class', 'layer_label')
.text((n: MapNode) => { return n.z});
.text((n: MapNode) => { return n.z})
.attr('x', function(n: MapNode) {
if(n.z >= 100 ) return n.width/2 - 13
else if(n.z >= 10 ) return n.width/2 - 9
else return n.width/2 - 5
})
.attr('y', (n: MapNode) => n.height/2 + 5)
.attr('style', () => {
const styles: string[] = [];
styles.push(`font-family: "Noto Sans"`);
styles.push(`font-size: 11pt`);
styles.push(`font-weight: bold`);
return styles.join('; ');
})
.attr('fill', `#ffffff`);
// update image of node
node_body_merge