mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-10 03:49:53 +00:00
Calculates points relatively to (0,0)
This commit is contained in:
parent
72bdeceb20
commit
d2a2c60db1
@ -90,7 +90,7 @@ export class LinksWidget implements Widget {
|
||||
.attr('transform', function(l) {
|
||||
if (l.source && l.target) {
|
||||
const translation = self.multiLinkCalculatorHelper.linkTranslation(l.distance, l.source, l.target);
|
||||
return `translate (${translation.dx + l.source.width / 2.}, ${translation.dy + l.source.height / 2.})`;
|
||||
return `translate (${translation.dx}, ${translation.dy})`;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
@ -52,8 +52,8 @@ export class NodesWidget implements Widget {
|
||||
|
||||
selection
|
||||
.select<SVGTextElement>('text.label')
|
||||
.attr('x', (n: Node) => n.label.x)
|
||||
.attr('y', (n: Node) => n.label.y)
|
||||
.attr('x', (n: Node) => n.label.x - n.width / 2.)
|
||||
.attr('y', (n: Node) => n.label.y - n.height / 2. + 20) // @todo: server computes y in auto way
|
||||
.attr('style', (n: Node) => n.label.style)
|
||||
.text((n: Node) => n.label.text);
|
||||
|
||||
@ -88,7 +88,12 @@ export class NodesWidget implements Widget {
|
||||
return 'data:image/svg+xml;base64,none';
|
||||
})
|
||||
.attr('width', (n: Node) => n.width)
|
||||
.attr('height', (n: Node) => n.height);
|
||||
.attr('height', (n: Node) => n.height)
|
||||
.attr('x', (n: Node) => -n.width / 2.)
|
||||
.attr('y', (n: Node) => -n.height / 2.);
|
||||
|
||||
// .attr('width', (n: Node) => n.width)
|
||||
// .attr('height', (n: Node) => n.height);
|
||||
// .on('mouseover', function (this, n: Node) {
|
||||
// select(this).attr("class", "over");
|
||||
// })
|
||||
|
@ -277,7 +277,7 @@ export class ProjectMapComponent implements OnInit {
|
||||
const data = drawingLineTool.stop();
|
||||
this.onLineCreation(data['node'], data['port'], node, port);
|
||||
} else {
|
||||
drawingLineTool.start(node.x + node.width / 2., node.y + node.height / 2., {
|
||||
drawingLineTool.start(node.x, node.y, {
|
||||
'node': node,
|
||||
'port': port
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user