예제 #1
0
        protected virtual Drawable PropagatePressed(IEnumerable <Drawable> drawables, InputState state, T pressed, float scrollAmount = 0, bool isPrecise = false, bool repeat = false)
        {
            Drawable handled = null;

            // only handle if we are a new non-pressed action (or a concurrency mode that supports multiple simultaneous triggers).
            if (simultaneousMode == SimultaneousBindingMode.All || !pressedActions.Contains(pressed))
            {
                pressedActions.Add(pressed);

                if (scrollAmount != 0)
                {
                    var scrollEvent = new KeyBindingScrollEvent <T>(state, pressed, scrollAmount, isPrecise);
                    handled = drawables.FirstOrDefault(d => triggerKeyBindingEvent(d, scrollEvent));
                }

                if (handled == null)
                {
                    var pressEvent = new KeyBindingPressEvent <T>(state, pressed, repeat);
                    handled = drawables.FirstOrDefault(d => triggerKeyBindingEvent(d, pressEvent));
                }
            }

            if (handled != null)
            {
                Logger.Log($"Pressed ({pressed}) handled by {handled}.", LoggingTarget.Runtime, LogLevel.Debug);
            }

            return(handled);
        }
            public bool OnScroll(KeyBindingScrollEvent <TestAction> e)
            {
                if (Action == e.Action)
                {
                    ++OnScrollCount;
                    LastScrollAmount = e.ScrollAmount;
                }

                return(false);
            }
예제 #3
0
        public bool OnScroll(KeyBindingScrollEvent <GlobalAction> e)
        {
            switch (e.Action)
            {
            case GlobalAction.EditorIncreaseDistanceSpacing:
            case GlobalAction.EditorDecreaseDistanceSpacing:
                return(adjustDistanceSpacing(e.Action, e.ScrollAmount * adjust_step));
            }

            return(false);
        }
예제 #4
0
 public bool OnScroll(KeyBindingScrollEvent <GlobalAction> e) =>
 ScrollActionRequested?.Invoke(e.Action, e.ScrollAmount, e.IsPrecise) ?? false;