2020-10-08 15:52:09 +00:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
import { action } from '@ember/object';
|
2021-01-05 10:05:59 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2020-10-08 15:52:09 +00:00
|
|
|
|
2020-11-12 15:40:15 +00:00
|
|
|
export default class TopologyMetricsUpLines extends Component {
|
2020-10-08 15:52:09 +00:00
|
|
|
@tracked iconPositions;
|
2021-01-05 10:05:59 +00:00
|
|
|
@service('dom') dom;
|
|
|
|
|
|
|
|
get guid() {
|
|
|
|
return this.dom.guid(this);
|
|
|
|
}
|
2020-10-08 15:52:09 +00:00
|
|
|
|
|
|
|
@action
|
|
|
|
getIconPositions() {
|
|
|
|
const center = this.args.center;
|
2020-12-08 15:47:55 +00:00
|
|
|
const view = this.args.view;
|
2020-10-08 15:52:09 +00:00
|
|
|
const lines = [...document.querySelectorAll('#upstream-lines path')];
|
|
|
|
|
|
|
|
this.iconPositions = lines.map(item => {
|
|
|
|
const pathLen = parseFloat(item.getTotalLength());
|
|
|
|
const partLen = item.getPointAtLength(Math.ceil(pathLen * 0.666));
|
|
|
|
return {
|
|
|
|
id: item.id,
|
2020-12-02 09:43:34 +00:00
|
|
|
x: Math.round(partLen.x - center.x),
|
2020-12-08 15:47:55 +00:00
|
|
|
y: Math.round(partLen.y - view.y),
|
2020-10-08 15:52:09 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|