And my goal is to draw some text on top of pins constantly - including map movement.
So I call MapCanvas.InvalidateSurface(); 30 times every second (for 30 FPS) and execute the following code in Draw():
As you can see, I use Map's Region property to find the right screen coords to write text.
And to make this text "follow" pins when user moves the map, I need Region to update exactly this frequently, but it doesn't - so I get laggy labels which update its position only when map moves slow enough.
But I didn't name this issue like this for nothing - strange things happen with the following code:
In debug mode Region starts updating much more frequently, and my labels follow their pins better (with some lags though).
This doesn't work if I launch the app not through IDE but through tapping its icon on the device, because the Debug.WriteLine gets ignored while not debugging.
If instead I use map.Region.ToString() in the UI itself, labels still lag as if Map_CameraMoving wasn't there in the first place.
EXPECTED BEHAVIOR
Basically I want Region to update at least 30 times a second to draw labels and move them smoothly, or at least a hacky way to make it update more frequently which doesn't use debugging.
HOW TO REPRODUCE
Download SkiaSharp, SkiaSharp.Views and SkiaSharp.Views.Forms from NuGet (all three are v1.68.0)
Use the layout provided in the first block of code.
VERSIONS
PLATFORMS
ACTUAL BEHAVIOR
Greetings. I am using SkiaSharp canvas on top of the GoogleMaps (with Clustering library) view like this:
And my goal is to draw some text on top of pins constantly - including map movement. So I call
MapCanvas.InvalidateSurface();
30 times every second (for 30 FPS) and execute the following code inDraw()
:As you can see, I use Map's
Region
property to find the right screen coords to write text. And to make this text "follow" pins when user moves the map, I need Region to update exactly this frequently, but it doesn't - so I get laggy labels which update its position only when map moves slow enough. But I didn't name this issue like this for nothing - strange things happen with the following code:In debug mode
Region
starts updating much more frequently, and my labels follow their pins better (with some lags though). This doesn't work if I launch the app not through IDE but through tapping its icon on the device, because theDebug.WriteLine
gets ignored while not debugging. If instead I usemap.Region.ToString()
in the UI itself, labels still lag as ifMap_CameraMoving
wasn't there in the first place.EXPECTED BEHAVIOR
Basically I want Region to update at least 30 times a second to draw labels and move them smoothly, or at least a hacky way to make it update more frequently which doesn't use debugging.
HOW TO REPRODUCE
while (true)
loop where you callDraw
method provided in the second block of code.Map
method:Region
object inMap_CameraMoving
.