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); }
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); }
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; }
private void UpdateHistory(FocusArea focus) { for (int i = focus.Start; i < focus.End; i++) _history[i] = DateTime.Now; }
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; } }