startCalibration method

  1. @override
Future<bool> startCalibration(
  1. List<CalibrationPoint> points
)
override

Implementation

@override
Future<bool> startCalibration(List<CalibrationPoint> points) async {
  if (_currentState != EyeTrackingState.ready &&
      _currentState != EyeTrackingState.tracking) {
    return false;
  }

  try {
    _calibrationPoints = List.from(points);
    _isCalibrating = true;
    _currentState = EyeTrackingState.calibrating;

    // Clear existing calibration if WebGazer is loaded
    if (_webGazerStarted && js.context.hasProperty('webgazer')) {
      try {
        js.context['webgazer'].callMethod('clearData');
      } catch (e) {
        js.context.callMethod('eval', ['webgazer.clearData()']);
      }
    }

    return true;
  } catch (e) {
    return false;
  }
}