@@ -42,38 +42,34 @@ export function normalizeCursorTelemetry(
4242 . sort ( ( a , b ) => a . timeMs - b . timeMs )
4343 . map ( ( sample ) => normalizeTelemetrySample ( sample , totalMs ) ) ;
4444
45- const hasExplicitCursorTypeSamples = normalized . some ( ( sample ) => Boolean ( sample . cursorType ) ) ;
46-
47- if ( hasExplicitCursorTypeSamples ) {
48- const interactions = detectInteractionCandidates ( normalized ) ;
49- for ( const candidate of interactions ) {
50- if ( candidate . kind === 'text-selection' ) {
51- applyCursorTypeInRange ( normalized , candidate . centerTimeMs - 140 , candidate . centerTimeMs + 1200 , 'text' ) ;
52- continue ;
53- }
45+ const interactions = detectInteractionCandidates ( normalized ) ;
46+ for ( const candidate of interactions ) {
47+ if ( candidate . kind === 'text-selection' ) {
48+ applyCursorTypeInRange ( normalized , candidate . centerTimeMs - 140 , candidate . centerTimeMs + 1200 , 'text' ) ;
49+ continue ;
50+ }
5451
55- if ( candidate . kind === 'text-field-click' || candidate . kind === 'text-focus-like' ) {
56- applyCursorTypeInRange ( normalized , candidate . centerTimeMs - 100 , candidate . centerTimeMs + 900 , 'text' ) ;
57- continue ;
58- }
52+ if ( candidate . kind === 'text-field-click' || candidate . kind === 'text-focus-like' ) {
53+ applyCursorTypeInRange ( normalized , candidate . centerTimeMs - 100 , candidate . centerTimeMs + 900 , 'text' ) ;
54+ continue ;
5955 }
56+ }
6057
61- for ( const sample of normalized ) {
62- if ( sample . interactionType !== 'click' && sample . interactionType !== 'double-click' ) {
63- continue ;
64- }
58+ for ( const sample of normalized ) {
59+ if ( sample . interactionType !== 'click' && sample . interactionType !== 'double-click' ) {
60+ continue ;
61+ }
6562
66- const mouseUp = normalized . find ( ( candidate ) => candidate . timeMs > sample . timeMs && candidate . interactionType === 'mouseup' ) ;
67- if ( ! mouseUp ) {
68- continue ;
69- }
63+ const mouseUp = normalized . find ( ( candidate ) => candidate . timeMs > sample . timeMs && candidate . interactionType === 'mouseup' ) ;
64+ if ( ! mouseUp ) {
65+ continue ;
66+ }
7067
71- const dragDuration = mouseUp . timeMs - sample . timeMs ;
72- const dragDistance = Math . hypot ( mouseUp . cx - sample . cx , mouseUp . cy - sample . cy ) ;
73- if ( dragDuration >= 160 && dragDistance > 0.015 ) {
74- const isTextDrag = Math . abs ( mouseUp . cx - sample . cx ) > Math . abs ( mouseUp . cy - sample . cy ) * 1.8 ;
75- applyCursorTypeInRange ( normalized , sample . timeMs , mouseUp . timeMs , isTextDrag ? 'text' : 'closed-hand' ) ;
76- }
68+ const dragDuration = mouseUp . timeMs - sample . timeMs ;
69+ const dragDistance = Math . hypot ( mouseUp . cx - sample . cx , mouseUp . cy - sample . cy ) ;
70+ if ( dragDuration >= 160 && dragDistance > 0.015 ) {
71+ const isTextDrag = Math . abs ( mouseUp . cx - sample . cx ) > Math . abs ( mouseUp . cy - sample . cy ) * 1.8 ;
72+ applyCursorTypeInRange ( normalized , sample . timeMs , mouseUp . timeMs , isTextDrag ? 'text' : 'closed-hand' ) ;
7773 }
7874 }
7975
0 commit comments