/** * Rem-to-pixel conversion at the CURRENT root font size. * * The interface scale (settings.uiScale) works by setting the root font-size, * so any TypeScript that positions or measures against rem-sized CSS must * convert through the LIVE root — never through an assumed 16. Both context * menus' flip/clamp math is the canonical consumer: their widths and row * heights are rem in CSS, and hardcoding their px mirrors is exactly the bug * that made the shadlike menu flip at the wrong edge once scaling landed. * * Read per call, not cached: the scale can change mid-session (stepper, * Ctrl+/-) and a menu opened after that must measure against the new root. */ export function remPx(rem: number): number { return rem * parseFloat(getComputedStyle(document.documentElement).fontSize); }