-
-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When touching and holding a long press, mapControl becomes blank #2396
Comments
I added the log
|
Given the number of things on my plate this is not something I will try to reproduce. I don't have a touch screen and don't work default on Linux. The bug could be related to extreme values (near zero or maximum double) in the unitsPerPixel, or something weird in the resolutions. It is probably a real bug in Mapsui or BruTile. It could also be a bug in Avalonia. What you could do it try to reproduce it with the Avalonia sample that is part of this git repository. git clone git@github.com:Mapsui/Mapsui.git And run the Avalonia sample. This is the method in BruTile that is involved. public static int GetNearestLevel(IDictionary<int, Resolution> resolutions, double unitsPerPixel)
{
if (resolutions.Count == 0)
{
throw new ArgumentException("No tile resolutions");
}
var orderedResolutions = resolutions.OrderByDescending(r => r.Value.UnitsPerPixel).ToList();
//smaller than smallest
if (orderedResolutions.Last().Value.UnitsPerPixel > unitsPerPixel) return orderedResolutions.Last().Key;
//bigger than biggest
if (orderedResolutions.First().Value.UnitsPerPixel < unitsPerPixel) return orderedResolutions.First().Key;
var result = -1;
var resultDistance = double.MaxValue;
foreach (var current in orderedResolutions)
{
var distance = Math.Abs(current.Value.UnitsPerPixel - unitsPerPixel);
if (distance < resultDistance)
{
result = current.Key;
resultDistance = distance;
}
}
if (result < 0) throw new Exception("Unexpected error when calculating nearest level");
return result;
} |
oh and I forgot. Thanks for the bug report! The movie really helps. |
I tried the Avalonia demo and this issue also occurs. Since the test environment can only be offline, I only tested the mbtiles format. I'll try again with a map in a different offline format |
But that means you could retrieve can see what is happening in the debugger when result is smaller than zero. What are argument values for the resolutions and the unitsPerPixel. |
Mapsui Version
Mapsui 4.1
Mapsui Platform
Avalonia
Device
Linux
Describe the bug
I load a map in mbtiles format, and when I touch and hold the screen, the map becomes blank. However, I don't encounter this issue when I long-press with a mouse. It seems to trigger the system's long-press for right-click gesture.
I haven't added any additional code, just loaded the map, and no exceptions were thrown.
QQ202418-14468.mp4
I'm not sure if this is a bug or not.
The text was updated successfully, but these errors were encountered: