Exemplo n.º 1
0
        public void Aggregate(AggregationEntry entry, AggregationContext context)
        {
            if (disableWhen(inputHelper))
            {
                return;
            }
            if (!context.FirstEntry)
            {
                return;
            }

            double timeDelta = context.Time(span => span.TotalSeconds);

            if (ShouldHandle(next, AggregationAction.Next, timeDelta))
            {
                context.Reset();
                context.FocusControlAt(context.Indexer.Next);
            }
            if (ShouldHandle(previous, AggregationAction.Previous, timeDelta))
            {
                context.Reset();
                context.FocusControlAt(context.Indexer.Previous);
            }
            if (ShouldHandle(trigger, AggregationAction.Trigger, timeDelta))
            {
                context[context.Indexer.Current].Events.OnClicked();
            }

            aggrAction = scriptHasEvaluated ? aggrAction : AggregationAction.None;

            scriptHasEvaluated = false;
            context.FirstEntry = false;
        }
Exemplo n.º 2
0
 private void CheckClick(AggregationEntry entry, AggregationContext context)
 {
     if (entry.Token.CanBeClicked &&
         entry.Token.HasHover &&
         input.IsLeftButtonReleased())
     {
         entry.Control.Events.OnClicked();
     }
 }
Exemplo n.º 3
0
 private void CheckSelected(AggregationEntry entry, AggregationContext context)
 {
     if (input.IsLeftButtonClicked())
     {
         if (entry.Token.HasHover)
         {
             entry.Token.CanBeClicked = true;
         }
     }
     if (!input.IsLeftButtonPressed())
     {
         entry.Token.CanBeClicked = false;
     }
 }
Exemplo n.º 4
0
        private void CheckMouseHover(AggregationEntry entry, AggregationContext context)
        {
            var currentHasHover = entry.Control.Region.Frame.Contains(input.MousePosition);

            if (currentHasHover && !entry.Token.HasHover)
            {
                entry.Control.HasHover = true;
            }
            else if (!currentHasHover && entry.Token.HasHover)
            {
                entry.Control.HasHover = false;
            }

            entry.Token.HasHover = currentHasHover;
        }
Exemplo n.º 5
0
        public void Aggregate(AggregationEntry entry, AggregationContext context)
        {
            if (!entry.Control.Options.IsEnabled || !this.IsEnabled)
            {
                return;
            }

            CheckMouseHover(entry, context);

            CheckClick(entry, context);

            if (entry.Control.Options.IsFocusEnabled)
            {
                CheckFocus(entry, context);
            }
        }
Exemplo n.º 6
0
 private void CheckFocus(AggregationEntry entry, AggregationContext context)
 {
     if (input.IsLeftButtonClicked())
     {
         if (entry.Token.HasHover && !entry.Control.HasFocus)
         {
             context.FocusControlAt(entry.Index);
             entry.Token.GotFocusBy = this;
         }
         else if (!entry.Token.HasHover && entry.Control.HasFocus)
         {
             context.Reset();
             entry.Token.GotFocusBy = null;
         }
     }
     CheckSelected(entry, context);
 }