1
0
Fork 0
zoomaccel/src/types.ts
2025-03-25 11:52:57 -06:00

63 lines
1.5 KiB
TypeScript

export interface Target {
x: number;
y: number;
radius: number;
}
export interface Stats {
startTime: number;
misclicks: number;
targetsHit: number;
times: number[];
zoomInTime: number; // Time spent zooming in during current trial
zoomOutTime: number; // Time spent zooming out during current trial
lastZoomTime: number; // Last timestamp of zoom event
isZooming: boolean; // Whether user is currently zooming
zoomDirection: 'in' | 'out' | null; // Current direction of zoom
}
export interface ViewportOffset {
x: number;
y: number;
}
export type ZoomPreset = 'A' | 'B' | 'C' | 'D';
export type AppMode = 'demo' | 'study';
export interface AccelerationSettings {
enabled: boolean;
accelerationCurve: number[];
preset?: ZoomPreset;
}
export interface Round {
timeSpent: number;
misclicks: number;
accelerationEnabled: boolean;
accelerationCurve?: number[];
preset?: ZoomPreset;
zoomInTime: number; // Time spent zooming in during this round
zoomOutTime: number; // Time spent zooming out during this round
timestamp: number;
}
export const CONSTANTS = {
TARGET_COUNT: 200,
TARGET_MIN_RADIUS: 250,
TARGET_MAX_RADIUS: 800,
VIRTUAL_CANVAS_SIZE: 50000,
ZOOM_LEVELS: {
min: 0.01,
max: 10,
default: 0.01,
},
MOUSE_WHEEL_SAMPLES: 5,
NUM_CURVE_POINTS: 5,
STUDY_TARGETS_PER_PRESET: 25,
PRESETS: {
A: [1, 1, 1, 1, 1], // Control: No zoom acceleration
B: [1, 2, 3, 4, 5], // Linear increase
C: [1, 1.5, 2.5, 4, 6], // Exponential increase
D: [1, 3, 4, 3, 1], // Bell curve
} as Record<ZoomPreset, number[]>,
} as const;