From b868033ddc7b43d8b0fe4c5f2ada34574d3dd98a Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sat, 22 Aug 2026 15:48:33 +0000 Subject: [PATCH] Pill shaped nodes --- frontend/src/TransitionGraph.vue | 65 +++--- frontend/src/analytics/transitions.js | 311 +++++++++++++++++--------- 2 files changed, 237 insertions(+), 139 deletions(-) diff --git a/frontend/src/TransitionGraph.vue b/frontend/src/TransitionGraph.vue index 59325d8..1f45fd1 100644 --- a/frontend/src/TransitionGraph.vue +++ b/frontend/src/TransitionGraph.vue @@ -10,7 +10,8 @@ import { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vu import { rangeWindow, WEEK } from './analytics/time.js' import { formatCount } from './analytics/format.js' import { - TNODE_R, + TNODE_W, + TNODE_H, BEAD_R, BEAD_SPEED, buildTransitionGraph, @@ -146,16 +147,17 @@ watch(svgEl, (el) => { }) watch(() => graph.value?.bounds, updateScale) onBeforeUnmount(() => resizeObs?.disconnect()) + +// Font size (px) that fits a label inside the pill width at the current +// zoom: ~0.52 em average glyph width, 12 px padding per side, capped. +const fitPx = (label) => + Math.min(15, (TNODE_W * pxPerUnit.value - 24) / (0.52 * Math.max(label.length, 1)))