Hi, I'am using ArcGIS SDK for .NET 10.2.7.0 and creating "modern" store app (Store API) for Windows 8.1. I have problem with DPI changes. On some monitors (Full HD, 24 inch, 100% scaling in Windows 10) returns MapViewTapped event correct location, but on some monitors (Full HD, 15 inch, 150% scaling) returns wrong location (several cm from correct position on Map).
Hi,
Unfortunately this is a bug in Windows 10 when running Windows Store 8.1 apps in different DPI settings. We have submitted support case to Microsoft for it. I'll have a look if we have update for this.
Thank you, is there some workaround? With pixel to coordinates ratio and real click point?
I found some workaround:
public async void OnMapTouch(object sender, MapViewInputEventArgs e)
{
MapView view = sender as MapView;
MapPoint mapPoint = e.Location; //clicked coordinate, not works on some DPI/DPI changes
double unitPerPx = view.UnitsPerPixel; //not works on some DPI/DPI changes
double unitPerPx_real = view.Extent.Width / view.ActualWidth; //it seems to works
double x_offset = e.Position.X * unitPerPx_real;
double y_offset = e.Position.Y * unitPerPx_real;
Viewpoint viewpoint = view.GetCurrentViewpoint(ViewpointType.BoundingGeometry);
double x = viewpoint.TargetGeometry.Extent.XMin + x_offset; //x coordinate, seems to works
double y = viewpoint.TargetGeometry.Extent.YMax - y_offset; //y coordinate, seems to works
....
Update:
But other functions, as mapView.Editor.RequestShapeAsync not works
Just an idea what to test. You could override editor progress and fix the geometry in the event.
I tried this:
var progress = new Progress<GeometryEditStatus>((status) =>
{
/ /never called
}
Esri.ArcGISRuntime.Geometry.Geometry newGeometry = await mapView.Editor.RequestShapeAsync(Esri.ArcGISRuntime.Controls.DrawShape.LineSegment, null, progress);
But progress delegate is never invoked during drawing
Ah, line segments doesn't have events since it's only one action. Ie. Polygons would raise the event. I take that the only way to fix LineSegment is to iterate through the Points collection and fix all the points. Not very convenient but might do the trick.
Thank you, I solved it by own drawing to Canvas and pixel -> coordinates workaround from former post.