Repository navigation
Conversation
|
Hi @lmotta Luiz, thank you for the PR, we'll have a look at this. Can you attach screens/video how the app now works on your device? |
|
Hi @tomasMizera, merginmaps_3xmapcanvas_mute.mp4In the video, on the left is the original Mergin Maps, and on the right is Mergin Maps with the 3x map canvas feature. |
tomasMizera
left a comment
There was a problem hiding this comment.
I had a look at the code and I am bit worried to simply enroll this to everyone. The main problem is that the main thread now renders 9x the pixels compared to what we do now. This could produce a degraded user experience (slower rendering) on more complex projects.
Ideally, the map tiles/screens around the phone should render only after the main screen is rendered or be split into multiple threads at least.
QGIS map canvas API has this option called setPreviewJobsEnabled that seem to be the solution on QGIS desktop side of things. Let's have a look if we can port that to the app too.
|
I built the branch locally and I can confirm that the feeling of working with the map is much better @lmotta :) |
|
Hi @tomasMizera, thanks for the review! To address the performance concerns, I've adjusted the approach based on your feedback: Parallel Rendering: The current implementation uses QgsMapRendererParallelJob inside refreshMap(), running the background map rendering in worker threads without blocking the main UI thread. Configurable Margin Ratio (MARGIN_RATIO = 0.5): To reduce the pixel rendering load compared to the initial 3.0x factor, I refactored the canvas expansion to use a configurable MARGIN_RATIO per side. Setting MARGIN_RATIO = 0.5 adds half a screen size of margin to each side, bringing the total canvas size to 2.0x (4x pixels instead of 9x). This reduces computational and memory demands significantly. While panning beyond half a screen in a single fast gesture will still expose the white background (just as a 1.0x factor would on fast pans), this 0.5 margin covers typical small-to-medium pan gestures while keeping background rendering work much lighter. Regarding setPreviewJobsEnabled, I haven't tested this option yet and I'm not sure if it is supported in the mobile environment or rendering pipeline. Please let me know if this lower margin ratio works as an acceptable compromise for the project! |
Description
This is an experimental PR to evaluate the impact and review workflow for expanding the map canvas rendering area (3x viewport).
Summary of Changes
InputMapCanvasMap::refreshMap()to render a pre-buffered 3x3 grid.InputMapCanvasMap::updateTransform().InputMapCanvasMap::updatePaintNode()to keep the physical viewport centered.Purpose
Prevents blank/unrendered white spaces from appearing during pan and drag gestures on mobile devices.