Beispiel #1
0
        protected override void Update()
        {
            base.Update();

            var  lastMouseSource = inputManager.CurrentState.Mouse.LastSource;
            bool hasValidInput   = lastMouseSource != null && !(lastMouseSource is ISourcedFromTouch);

            if (!hasValidInput || !CanShowCursor)
            {
                currentTarget?.Cursor?.Hide();
                currentTarget = null;
                return;
            }

            IProvideCursor newTarget = this;

            foreach (var d in inputManager.HoveredDrawables)
            {
                if (d is IProvideCursor p && p.ProvidingUserCursor)
                {
                    newTarget = p;
                    break;
                }
            }

            if (currentTarget == newTarget)
            {
                return;
            }

            currentTarget?.Cursor?.Hide();
            newTarget.Cursor?.Show();

            currentTarget = newTarget;
        }
Beispiel #2
0
        protected override void Update()
        {
            base.Update();

            if (!CanShowCursor)
            {
                currentTarget?.Cursor?.Hide();
                currentTarget = null;
                return;
            }

            IProvideCursor newTarget = this;

            foreach (var d in inputManager.HoveredDrawables)
            {
                if (d is IProvideCursor p && p.ProvidingUserCursor)
                {
                    newTarget = p;
                    break;
                }
            }

            if (currentTarget == newTarget)
            {
                return;
            }

            currentTarget?.Cursor?.Hide();
            newTarget.Cursor?.Show();

            currentTarget = newTarget;
        }
Beispiel #3
0
        protected override void Update()
        {
            base.Update();

            if (!CanShowCursor)
            {
                currentTarget?.Cursor?.Hide();
                return;
            }

            var newTarget = inputManager.HoveredDrawables.OfType <IProvideCursor>().FirstOrDefault(t => t.ProvidingUserCursor) ?? this;

            if (currentTarget == newTarget)
            {
                return;
            }

            currentTarget?.Cursor?.Hide();
            newTarget.Cursor?.Show();

            currentTarget = newTarget;
        }