You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I try use skiasharp draw something on uwp, but i find the position draw on SKXamCanvas is not correct.
when i draw a point on (50,50), i use mouse click the point ,get (40,40) by e.GetCurrentPoint(view).Position,
when i draw a point on (100,100),i use mouse click the point ,get (80,80) by e.GetCurrentPoint(view).Position,
when i draw a point on (400,400), i use mouse click the point ,get (320,320) by e.GetCurrentPoint(view).Position.
Then i use win2d.uwp do same thing, it's correct, draw point on (50,50),click it, i can get (50,50).
Then i use SKCanvasView do it on Android, it's correct,.
Code
if(something){
//something
}
//use win2d
else if (e.ClickedItem.Equals(Win2DDrawPositionTestListItem))
{
//Container is a Grid
Container.Children.Clear();
var view = new CanvasControl();
Container.Children.Add(view);
Point clickPoint = new Point(0, 0);
view.Draw += (senderTemp, eTemp) =>
{
var graphics = eTemp.DrawingSession;
graphics.FillCircle(new System.Numerics.Vector2(50, 50), 2, SKColors.Red.ToColor());
graphics.FillCircle(new System.Numerics.Vector2(100, 100), 2, SKColors.Red.ToColor());
graphics.FillCircle(new System.Numerics.Vector2(400, 400), 2, SKColors.Red.ToColor());
if (clickPoint.X != 0)
{
graphics.FillCircle(new System.Numerics.Vector2(400, 400), 1, SKColors.Yellow.ToColor());
}
};
view.PointerPressed += (senderTemp, eTemp) =>
{
clickPoint = eTemp.GetCurrentPoint(view).Position;
Debug.WriteLine(DateTime.Now + ": Click Position (" + clickPoint.X + "," + clickPoint.Y + ")");
};
}
//use Skiasharp
else if (e.ClickedItem.Equals(SkiaDrawPositionTestListItem))
{
Container.Children.Clear();
var view = new SKXamlCanvas();
Container.Children.Add(view);
Point clickPoint = new Point(0, 0);
var paint = new SKPaint() { Color = SKColors.Red, Style = SKPaintStyle.Fill };
view.PaintSurface += (senderTemp, eTemp) =>
{
var graphics = eTemp.Surface.Canvas;
graphics.DrawCircle(new SKPoint(50, 50), 5, paint);
graphics.DrawCircle(new SKPoint(100, 100), 5, paint);
graphics.DrawCircle(new SKPoint(400, 400), 5, paint);
if (clickPoint.X != 0)
{
paint.Color = SKColors.Yellow;
graphics.DrawCircle(clickPoint.ToSKPoint(), 3, paint);
}
};
view.PointerPressed += (senderTemp, eTemp) =>
{
clickPoint = eTemp.GetCurrentPoint(view).Position;
Debug.WriteLine(DateTime.Now + ": Click Position (" + clickPoint.X + "," + clickPoint.Y + ")");
};
}
Xaml, this canvas will be replaced by win2d or skiasharp in C# code
Description
I try use skiasharp draw something on uwp, but i find the position draw on SKXamCanvas is not correct.
when i draw a point on (50,50), i use mouse click the point ,get (40,40) by
e.GetCurrentPoint(view).Position
,when i draw a point on (100,100),i use mouse click the point ,get (80,80) by
e.GetCurrentPoint(view).Position
,when i draw a point on (400,400), i use mouse click the point ,get (320,320) by
e.GetCurrentPoint(view).Position
.Then i use win2d.uwp do same thing, it's correct, draw point on (50,50),click it, i can get (50,50).
Then i use SKCanvasView do it on Android, it's correct,.
Code
Xaml, this canvas will be replaced by win2d or skiasharp in C# code
Expected Behavior
Actual Behavior
Basic Information
Detailed IDE/OS information (click to expand)
Screenshots
Reproduction Link
The text was updated successfully, but these errors were encountered: