Copy from SkiaSharp.Views.Forms.WinForms (015fa3932e)

This commit is contained in:
aosoft 2018-01-05 21:05:55 +09:00
Родитель 90206d253d
Коммит 7843726df1
2 изменённых файлов: 19 добавлений и 4 удалений

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

@ -20,6 +20,10 @@ using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.UWP.SKPaintSurfaceEventArg
using Xamarin.Forms.Platform.MacOS;
using SKNativeView = SkiaSharp.Views.Mac.SKCanvasView;
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.Mac.SKPaintSurfaceEventArgs;
#else
using Xamarin.Forms.Platform.WinForms;
using SKNativeView = SkiaSharp.Views.Desktop.SKControl;
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs;
#endif
namespace SkiaSharp.Views.Forms
@ -48,6 +52,11 @@ namespace SkiaSharp.Views.Forms
touchHandler = new SKTouchHandler(
args => ((ISKCanvasViewController)Element).OnTouch(args),
coord => Element.IgnorePixelScaling ? coord : (float)(coord * Control.Dpi));
#else
touchHandler = new SKTouchHandler(
args => ((ISKCanvasViewController)Element).OnTouch(args),
//coord => Element.IgnorePixelScaling ? coord : (float)(coord * Control.Dpi));
coord => coord);
#endif
}
@ -83,7 +92,7 @@ namespace SkiaSharp.Views.Forms
// set the initial values
touchHandler.SetEnabled(Control, e.NewElement.EnableTouchEvents);
Control.IgnorePixelScaling = e.NewElement.IgnorePixelScaling;
//Control.IgnorePixelScaling = e.NewElement.IgnorePixelScaling;
// subscribe to events from the user
newController.SurfaceInvalidated += OnSurfaceInvalidated;
@ -112,11 +121,11 @@ namespace SkiaSharp.Views.Forms
{
base.OnElementPropertyChanged(sender, e);
if (e.PropertyName == SKFormsView.IgnorePixelScalingProperty.PropertyName)
/*if (e.PropertyName == SKFormsView.IgnorePixelScalingProperty.PropertyName)
{
Control.IgnorePixelScaling = Element.IgnorePixelScaling;
}
else if (e.PropertyName == SKFormsView.EnableTouchEventsProperty.PropertyName)
else*/ if (e.PropertyName == SKFormsView.EnableTouchEventsProperty.PropertyName)
{
touchHandler.SetEnabled(Control, Element.EnableTouchEvents);
}

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

@ -1,4 +1,5 @@
using System;
#if OPENGL
using System;
using System.ComponentModel;
using Xamarin.Forms;
@ -20,6 +21,10 @@ using SKNativePaintGLSurfaceEventArgs = SkiaSharp.Views.UWP.SKPaintGLSurfaceEven
using Xamarin.Forms.Platform.MacOS;
using SKNativeView = SkiaSharp.Views.Mac.SKGLView;
using SKNativePaintGLSurfaceEventArgs = SkiaSharp.Views.Mac.SKPaintGLSurfaceEventArgs;
#else
using Xamarin.Forms.Platform.WinForms;
using SKNativeView = SkiaSharp.Views.Desktop.SKGLControl;
using SKNativePaintGLSurfaceEventArgs = SkiaSharp.Views.Desktop.SKPaintGLSurfaceEventArgs;
#endif
namespace SkiaSharp.Views.Forms
@ -204,3 +209,4 @@ namespace SkiaSharp.Views.Forms
#endif
}
}
#endif