refactor(ComparisonView): size crossfade window per line

This commit is contained in:
Ilia Mashkov
2026-06-03 16:03:51 +03:00
parent 600b905e01
commit 744cdc9d19
2 changed files with 5 additions and 12 deletions
@@ -10,6 +10,7 @@
import {
type ComparisonLine,
computeLineRenderModel,
windowSizeForLine,
} from '$entities/Font';
import { getTypographySettingsStore } from '$features/AdjustTypography';
import { getComparisonStore } from '../../model';
@@ -24,16 +25,14 @@ interface Props {
* Count of chars the slider has passed, from `findSplitIndex`.
*/
split: number;
/**
* Number of chars in the crossfade window around the split.
*/
windowSize: number;
}
let { line, split, windowSize }: Props = $props();
let { line, split }: Props = $props();
const comparisonStore = getComparisonStore();
const windowSize = $derived(windowSizeForLine(line.chars.length));
const model = $derived(computeLineRenderModel(line, split, windowSize));
const typography = getTypographySettingsStore();