This commit is contained in:
Matthew Leibowitz 2017-06-01 14:22:10 -05:00
Родитель 165f9bdcf8
Коммит bc6ec734f1
3 изменённых файлов: 301 добавлений и 259 удалений

Просмотреть файл

@ -38,24 +38,66 @@ namespace SkiaSharp.Views.Forms
{
base.MouseDown(mouseEvent);
FireEvent(SKTouchActionType.Pressed, mouseEvent, true);
FireEvent(SKTouchActionType.Pressed, SKMouseButton.Left, SKTouchDeviceType.Mouse, mouseEvent, true);
}
public override void MouseUp(NSEvent mouseEvent)
{
base.MouseUp(mouseEvent);
FireEvent(SKTouchActionType.Released, mouseEvent, false);
FireEvent(SKTouchActionType.Released, SKMouseButton.Left, SKTouchDeviceType.Mouse, mouseEvent, false);
}
public override void MouseDragged(NSEvent mouseEvent)
{
base.MouseDragged(mouseEvent);
FireEvent(SKTouchActionType.Moved, mouseEvent, true);
FireEvent(SKTouchActionType.Moved, SKMouseButton.Left, SKTouchDeviceType.Mouse, mouseEvent, true);
}
private bool FireEvent(SKTouchActionType actionType, NSEvent mouseEvent, bool inContact)
public override void OtherMouseDown(NSEvent mouseEvent)
{
base.OtherMouseDown(mouseEvent);
FireEvent(SKTouchActionType.Pressed, SKMouseButton.Middle, SKTouchDeviceType.Mouse, mouseEvent, true);
}
public override void OtherMouseUp(NSEvent mouseEvent)
{
base.OtherMouseUp(mouseEvent);
FireEvent(SKTouchActionType.Released, SKMouseButton.Middle, SKTouchDeviceType.Mouse, mouseEvent, false);
}
public override void OtherMouseDragged(NSEvent mouseEvent)
{
base.OtherMouseDragged(mouseEvent);
FireEvent(SKTouchActionType.Moved, SKMouseButton.Middle, SKTouchDeviceType.Mouse, mouseEvent, true);
}
public override void RightMouseDown(NSEvent mouseEvent)
{
base.RightMouseDown(mouseEvent);
FireEvent(SKTouchActionType.Pressed, SKMouseButton.Right, SKTouchDeviceType.Mouse, mouseEvent, true);
}
public override void RightMouseUp(NSEvent mouseEvent)
{
base.RightMouseUp(mouseEvent);
FireEvent(SKTouchActionType.Released, SKMouseButton.Right, SKTouchDeviceType.Mouse, mouseEvent, false);
}
public override void RightMouseDragged(NSEvent mouseEvent)
{
base.RightMouseDragged(mouseEvent);
FireEvent(SKTouchActionType.Moved, SKMouseButton.Right, SKTouchDeviceType.Mouse, mouseEvent, true);
}
private bool FireEvent(SKTouchActionType actionType, SKMouseButton mouse, SKTouchDeviceType device, NSEvent mouseEvent, bool inContact)
{
if (onTouchAction == null || scalePixels == null)
return false;
@ -68,7 +110,7 @@ namespace SkiaSharp.Views.Forms
var point = new SKPoint((float)scalePixels(cgPoint.X), (float)scalePixels(cgPoint.Y));
var args = new SKTouchActionEventArgs(id, actionType, point, inContact);
var args = new SKTouchActionEventArgs(id, actionType, mouse, device, point, inContact);
onTouchAction(args);
return args.Handled;
}