Esempio n. 1
0
        public void UpdateFocus(int center, bool animateTransition)
        {
            _focus = new FocusArea(center, center - _focusRadius, center + _focusRadius);
            _focus = _focus.Clip(Model.Default.Document.Length);

            DOIStrategy.OnFocusChanged();
            View.Default.UpdateLayout(animateTransition);
        }
Esempio n. 2
0
        private void InflateWeights(FocusArea focus, float multiplier, float timePassed, float power)
        {
            for (int i = focus.Start; i < focus.End; i++)
            {
                float distanceWeight = 1.0f - (float)focus.DistanceToCenter(i) / focus.Lines;
                _weights[i] += multiplier * (float)Math.Pow(timePassed, power) * distanceWeight;
            }

            Normalize(_weights);
        }
Esempio n. 3
0
        public virtual void OnFocusChanged()
        {
            float timePassed = (float)(DateTime.Now - _lastChange).TotalSeconds;

            if (timePassed > _timeout && _lastFocus != null)
            {
                InflateWeights(_lastFocus, 0.05f, timePassed, timePower);
                UpdateHistory(_lastFocus);
            }

            _lastChange = DateTime.Now;
            _lastFocus = Model.Default.Focus;
        }
Esempio n. 4
0
 private void UpdateHistory(FocusArea focus)
 {
     for (int i = focus.Start; i < focus.End; i++)
         _history[i] = DateTime.Now;
 }
Esempio n. 5
0
        private void InitDOI()
        {
            //_maxWeight = 0.1f;
            _lastChange = DateTime.Now;
            _lastFocus = Model.Default.Focus;

            _semanticWeights = Utilities.CreateSemanticWeights(50);

            _weights = new float[Model.Default.Length];
            _history = new DateTime[Model.Default.Length];

            for (int i = 0; i < Model.Default.Length; i++)
            {
                _weights[i] = 1f;
                _history[i] = _lastChange;
            }
        }