mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-02 21:09:09 +00:00
refactor(teleprompter): remove duplicated knowledge the compiler cannot police
A maintenance pass over the view, aimed at the places where a later change would go wrong quietly rather than fail. Every option default existed three times: the declaration the params editor renders, the fallback the parser applies, and a fallback in the stylesheet that nothing could reach because the view always sets the variable. Editing one left the editor showing a value the view was not using. Defaults and bounds now live in one object which both the declaration and the parser read, and the dead stylesheet copies are gone. A test asserts that parsing an empty query returns exactly what the editor declares, so the two cannot drift apart again. That test found the first case immediately: the script source declared a default of none but parsed to null. It is now none in both, which also takes a null out of the options type and a branch out of the view. The speed step was a constant in the keymap and a literal in the overlay, so the buttons would have kept stepping by two if the constant ever changed. Both now read the same export. The line height was measured by looking up an element by a data attribute set in another file. Removing that attribute would not have failed, it would have fallen back to a guess which happens to be correct at the default line height and wrong at any other. The measurement now reads the element the hook already holds, which is where the stylesheet sets the line height. Confirmed against the browser: at double the line height the script travels 1.98 times as far. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cb8RVPNQ2ETPJxdy4b8CHf
This commit is contained in:
@@ -10,6 +10,10 @@ export const MIN_SPEED = 2;
|
||||
export const MAX_SPEED = 200;
|
||||
export const DEFAULT_SPEED = 30;
|
||||
|
||||
/** how much one speed adjustment moves, shared by the keymap and the overlay */
|
||||
export const SPEED_STEP = 2;
|
||||
export const SPEED_STEP_COARSE = 10;
|
||||
|
||||
/** font size multiplier applied on top of the configured size by the +/- keys */
|
||||
const MIN_FONT_SCALE = 0.4;
|
||||
const MAX_FONT_SCALE = 3;
|
||||
|
||||
Reference in New Issue
Block a user