예제 #1
0
        private void Tick(object state)
        {
            var position = _gazePointHandler.CurrentPosition;

            if (position == null)
            {
                Reset();
                return;
            }
            var now    = _clock.Time;
            var button = _findButtonFunc(position.Value);

            if (button != _previousHover)
            {
                _previousHover = button;
                _hoverStartAt  = now;
                if (_cancellable && _inTrial)
                {
                    _spellerController.CancelTrial();
                    Reset();
                }
                return;
            }
            if (button == null || _inTrial)
            {
                return;
            }
            if (_clock.Unit.ToMilliseconds(Math.Abs(now - _startAt)) < _minTrialInterval)
            {
                return;
            }
            if (_clock.Unit.ToMilliseconds(Math.Abs(now - _hoverStartAt)) < _hoverToSelectDuration)
            {
                return;
            }
            _inTrial = true;
            _spellerController.CreateTrial();
        }
예제 #2
0
 public void Reset()
 {
     _startAt       = _clock.Time;
     _previousHover = null;
     _inTrial       = false;
 }