addCalibrationPoint method
Implementation
@override
Future<bool> addCalibrationPoint(CalibrationPoint point) async {
if (!_isCalibrating) return false;
try {
if (_webGazerStarted && js.context.hasProperty('webgazer')) {
// Add calibration point to WebGazer multiple times for better accuracy
for (int i = 0; i < 5; i++) {
try {
js.context['webgazer']
.callMethod('recordScreenPosition', [point.x, point.y]);
} catch (e) {
js.context.callMethod('eval',
['webgazer.recordScreenPosition(${point.x}, ${point.y})']);
}
await Future.delayed(const Duration(milliseconds: 100));
}
}
return true;
} catch (e) {
return false;
}
}