Beispiel #1
0
        private void Element_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs args)
        {
            var position = GetPosition(args);
            var buttons  = GetMouseButtons(args);
            var delta    = args.Delta;

            MouseWheel?.Invoke(this, new MouseWheelEventArgs(CurrentTime, position, PointerId.FromMouse(PointerId.MouseNoButton), buttons, delta));
        }
Beispiel #2
0
        private void Element_MouseMove(object sender, MouseEventArgs args)
        {
            var buttons  = GetMouseButtons(args);
            var id       = buttons & FirstMouseButton;
            var position = GetPosition(args);

            PointerMove?.Invoke(this, new PointerEventArgs(CurrentTime, position, PointerId.FromMouse(id), buttons));
        }
Beispiel #3
0
        private void Element_MouseDown(object sender, MouseButtonEventArgs args)
        {
            var id       = GetMouseButton(args);
            var buttons  = GetMouseButtons(args);
            var position = GetPosition(args);

            if (FirstMouseButton == 0)
            {
                FirstMouseButton = id;
            }

            PointerDown?.Invoke(this, new PointerEventArgs(CurrentTime, position, PointerId.FromMouse(id), buttons));
        }
Beispiel #4
0
        private void Element_MouseLeave(object sender, MouseEventArgs args)
        {
            var position = GetPosition(args);
            var buttons  = GetMouseButtons(args);

            if ((buttons & PointerId.MouseLeftButton) != 0)
            {
                PointerLost?.Invoke(this, new PointerEventArgs(CurrentTime, position, PointerId.FromMouse(PointerId.MouseLeftButton), buttons));
            }

            if ((buttons & PointerId.MouseRightButton) != 0)
            {
                PointerLost?.Invoke(this, new PointerEventArgs(CurrentTime, position, PointerId.FromMouse(PointerId.MouseRightButton), buttons));
            }

            if ((buttons & PointerId.MouseMiddleButton) != 0)
            {
                PointerLost?.Invoke(this, new PointerEventArgs(CurrentTime, position, PointerId.FromMouse(PointerId.MouseMiddleButton), buttons));
            }

            PointerLost?.Invoke(this, new PointerEventArgs(CurrentTime, position, PointerId.FromMouse(PointerId.MouseNoButton), buttons));
        }