* add incindent messages * feat(proto): regenerated proto files * feat(proto): insert incident message to CH * added incidents * genereate mobs * feat(db): added incident event insertion to PG * add incidents to session config * fixed activity incident highlight * fixed incidents search --------- Co-authored-by: Андрей Бабушкин <andreybabushkin2000@gmail.com>
21 lines
483 B
TypeScript
21 lines
483 B
TypeScript
import { getTimelinePosition } from '@/utils';
|
|
|
|
export function getTimelineEventWidth(
|
|
sessionDuration: number,
|
|
eventStart: number,
|
|
eventEnd: number,
|
|
): number | string {
|
|
if (eventStart < 0) {
|
|
eventStart = 0;
|
|
}
|
|
if (eventEnd > sessionDuration) {
|
|
eventEnd = sessionDuration;
|
|
}
|
|
if (eventStart === eventEnd) {
|
|
return '2px';
|
|
}
|
|
|
|
const width = ((eventEnd - eventStart) / sessionDuration) * 100;
|
|
|
|
return width < 1 ? '4px' : width;
|
|
}
|