John Cowen a5b9ada9ad
ui: New overlays (#9305)
Replaces ember-popover with tippy.js based overlay modifier.
2020-12-02 09:43:34 +00:00

24 lines
697 B
JavaScript

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class TopologyMetricsUpLines extends Component {
@tracked iconPositions;
@action
getIconPositions() {
const center = this.args.center;
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,
x: Math.round(partLen.x - center.x),
y: Math.round(partLen.y - center.y * 0.81),
};
});
}
}