mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-23 14:52:22 +00:00
Fix ethernet and serial links
This commit is contained in:
parent
96ec866b2e
commit
0d18166848
@ -8,9 +8,10 @@ import { Link } from "../models/link";
|
|||||||
export class EthernetLinkWidget implements Widget {
|
export class EthernetLinkWidget implements Widget {
|
||||||
|
|
||||||
public draw(view: SVGSelection, link: Link) {
|
public draw(view: SVGSelection, link: Link) {
|
||||||
|
|
||||||
const link_data = [[
|
const link_data = [[
|
||||||
[link.source.x + link.source.width / 2., link.source.y + link.source.height / 2.],
|
[link.source.x + link.source.width / 2., link.source.y + link.source.height / 2.],
|
||||||
[link.target.x + link.target.width / 2., link.target.y + link.source.height / 2.]
|
[link.target.x + link.target.width / 2., link.target.y + link.target.height / 2.]
|
||||||
]];
|
]];
|
||||||
|
|
||||||
const value_line = line();
|
const value_line = line();
|
||||||
|
@ -63,7 +63,6 @@ export class LinksWidget implements Widget {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const status_started = link_group
|
const status_started = link_group
|
||||||
.selectAll<SVGCircleElement, LinkStatus>('circle.status_started')
|
.selectAll<SVGCircleElement, LinkStatus>('circle.status_started')
|
||||||
.data(statuses.filter((link_status: LinkStatus) => link_status.status === 'started'));
|
.data(statuses.filter((link_status: LinkStatus) => link_status.status === 'started'));
|
||||||
|
@ -8,8 +8,17 @@ import { Link } from "../models/link";
|
|||||||
export class SerialLinkWidget implements Widget {
|
export class SerialLinkWidget implements Widget {
|
||||||
|
|
||||||
public draw(view: SVGSelection, link: Link) {
|
public draw(view: SVGSelection, link: Link) {
|
||||||
const dx = link.target.x - link.source.x;
|
const source = {
|
||||||
const dy = link.target.y - link.source.y;
|
'x': link.source.x + link.source.width / 2,
|
||||||
|
'y': link.source.y + link.source.height / 2
|
||||||
|
};
|
||||||
|
const target = {
|
||||||
|
'x': link.target.x + link.target.width / 2,
|
||||||
|
'y': link.target.y + link.target.height / 2
|
||||||
|
};
|
||||||
|
|
||||||
|
const dx = target.x - source.x;
|
||||||
|
const dy = target.y - source.y;
|
||||||
|
|
||||||
const vector_angle = Math.atan2(dy, dx);
|
const vector_angle = Math.atan2(dy, dx);
|
||||||
const rot_angle = -Math.PI / 4.0;
|
const rot_angle = -Math.PI / 4.0;
|
||||||
@ -19,20 +28,20 @@ export class SerialLinkWidget implements Widget {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const angle_source = [
|
const angle_source = [
|
||||||
link.source.x + dx / 2.0 + 15 * vect_rot[0],
|
source.x + dx / 2.0 + 15 * vect_rot[0],
|
||||||
link.source.y + dy / 2.0 + 15 * vect_rot[1]
|
source.y + dy / 2.0 + 15 * vect_rot[1]
|
||||||
];
|
];
|
||||||
|
|
||||||
const angle_target = [
|
const angle_target = [
|
||||||
link.target.x - dx / 2.0 - 15 * vect_rot[0],
|
target.x - dx / 2.0 - 15 * vect_rot[0],
|
||||||
link.target.y - dy / 2.0 - 15 * vect_rot[1]
|
target.y - dy / 2.0 - 15 * vect_rot[1]
|
||||||
];
|
];
|
||||||
|
|
||||||
const line_data = [
|
const line_data = [
|
||||||
[link.source.x, link.source.y],
|
[source.x, source.y],
|
||||||
angle_source,
|
angle_source,
|
||||||
angle_target,
|
angle_target,
|
||||||
[link.target.x, link.target.y]
|
[target.x, target.y]
|
||||||
];
|
];
|
||||||
|
|
||||||
let link_path = view.select<SVGPathElement>('path');
|
let link_path = view.select<SVGPathElement>('path');
|
||||||
|
Loading…
Reference in New Issue
Block a user