Esempio n. 1
0
        bool IInputListener.onMousePressed(Vector2 mousePos)
        {
            if (_selection.isDisabled() || _items.Count == 0)
            {
                return(false);
            }

            var lastSelectedItem = _selection.getLastSelected();
            var index            = getItemIndexUnderMousePosition(mousePos);

            index = Math.Max(0, index);
            index = Math.Min(_items.Count - 1, index);
            _selection.choose(_items[index]);

            if (lastSelectedItem != _items[index] && onChanged != null)
            {
                onChanged(_items[index]);
            }

            return(true);
        }