okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
0b3299a01
main
1export const PREVIEW_SPLIT_KEY = 'strata.preview-split.v1' ; 2export const DEFAULT_PREVIEW_FRACTION = 1.15 / 2.15 ; 3export const MIN_CHAT_WIDTH = 360 , MIN_PREVIEW_WIDTH = 320 ; 4export function previewWidth ( total :number , fraction :number ){ 5if ( ! Number . isFinite ( total ) || total <= 0 ) return 0 ; 6const lower = Math . min ( MIN_PREVIEW_WIDTH , total / 2 ), upper = Math . max ( lower , total - MIN_CHAT_WIDTH ); 7const value = Number . isFinite ( fraction ) ?fraction :DEFAULT_PREVIEW_FRACTION ; 8return Math . round ( Math . max ( lower , Math . min ( upper , total * value ))); 9} 10export function pointerPreviewFraction ( total :number , right :number , x :number ){ return total > 0 ?previewWidth ( total ,( right - x ) / total ) / total :DEFAULT_PREVIEW_FRACTION ;}