Esempio n. 1
0
        public static SkiTouch Get(
            long id,
            SKTouchAction type,
            SKMouseButton mouseButton,
            SKTouchDeviceType deviceType,
            SKPoint location,
            bool inContact,
            int wheelDelta
            )
        {
            if (!_cachedTouches.TryTake(out var result))
            {
                result = new SkiTouch();
            }

            if (mouseButton == SKMouseButton.Unknown && (inContact || type == SKTouchAction.Released || type == SKTouchAction.Cancelled))
            {
                // Unknown mouse button presses are not currently handled (extra mouse buttons),
                // so update them to act as a hover
                type      = SKTouchAction.Moved;
                inContact = false;
            }

            result.Id          = id;
            result.ActionType  = type;
            result.MouseButton = mouseButton;
            result.DeviceType  = deviceType;
            result.PointPixels = location;
            result.InContact   = inContact;
            result.WheelDelta  = wheelDelta;

            return(result);
        }
 public SKTouchEventArgs(long id, SKTouchAction type, SKMouseButton mouseButton, SKTouchDeviceType deviceType, SKPoint location, bool inContact)
 {
     Id          = id;
     ActionType  = type;
     DeviceType  = deviceType;
     MouseButton = mouseButton;
     Location    = location;
     InContact   = inContact;
 }
 public SKTouchEventArgs(long id, SKTouchAction type, SKMouseButton mouseButton, SKTouchDeviceType deviceType, SKPoint location, bool inContact, int wheelDelta, float pressure)
 {
     Id          = id;
     ActionType  = type;
     DeviceType  = deviceType;
     MouseButton = mouseButton;
     Location    = location;
     InContact   = inContact;
     WheelDelta  = wheelDelta;
     Pressure    = pressure;
 }
        private void FinishNewLinear(IssoPoint2D pt1, SKMouseButton MouseButton)
        {
            // Завершение ввода нового линейного компонента
            if (EditedComp?.CompType != ComponentTypes.ctLinear)
            {
                return;
            }

            ((ComponentLinear)EditedComp).End = pt1;
            ApplySnap((ComponentLinear)EditedComp, pt1);

            AddNewLinear();
            // Тут же начинаем новый элемент
            CreateNewLinear(((ComponentLinear)EditedComp).End);
        }
Esempio n. 5
0
        private bool FireEvent(SKTouchAction actionType, SKMouseButton mouse, SKTouchDeviceType device, NSEvent mouseEvent, bool inContact)
        {
            if (onTouchAction == null || scalePixels == null)
            {
                return(false);
            }

            var id = mouseEvent.ButtonNumber;

            var cgPoint = LocationInView(View);

            // flip the Y coordinate for macOS
            cgPoint.Y = View.Bounds.Height - cgPoint.Y;

            var point = new SKPoint((float)scalePixels(cgPoint.X), (float)scalePixels(cgPoint.Y));

            var args = new SKTouchEventArgs(id, actionType, mouse, device, point, inContact);

            onTouchAction(args);
            return(args.Handled);
        }
Esempio n. 6
0
 public SKTouchEventArgs(long id, SKTouchAction type, SKMouseButton mouseButton, SKTouchDeviceType deviceType, SKPoint location, bool inContact)
     : this(id, type, mouseButton, deviceType, location, inContact, 0)
 {
 }