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 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); }
public SKTouchEventArgs(long id, SKTouchAction type, SKMouseButton mouseButton, SKTouchDeviceType deviceType, SKPoint location, bool inContact) : this(id, type, mouseButton, deviceType, location, inContact, 0) { }
private static int GetTapDistanceDp(SKTouchDeviceType deviceType) { return(deviceType == SKTouchDeviceType.Mouse ? 10 : 25); }