mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-30 05:24:50 +02:00
[aidan] ux/canvas-tether: center the browser and view tether label on the line
This commit is contained in:
@@ -243,8 +243,9 @@ export function useTethers({
|
||||
|
||||
const midX = x1 + (x2 - x1) / 2;
|
||||
const midY = y1 + (y2 - y1) / 2;
|
||||
const labelX = isVertical ? midX : midX + (x2 - midX) * 0.15;
|
||||
const labelY = isVertical ? midY + (y2 - midY) * 0.15 : y2;
|
||||
// Center the pill on the line midpoint: the box is left-anchored at labelX, so back off half its text width (same trick as the monitor "Watching" label).
|
||||
const labelX = midX - (label.length * 7.5) / 2;
|
||||
const labelY = midY;
|
||||
|
||||
return {
|
||||
key,
|
||||
|
||||
Reference in New Issue
Block a user