erikabruni73 / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

Pinch zoom flickering #320

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use osmdroid library
2. Pinch to zoom without release the touch
3.

What is the expected output? What do you see instead?
I expect to smoth map render, but instead sometimes I see black lines 
flickering on the tiles margins

What version of the product are you using? On what operating system?
osmdroid 3.0.8 also it's true for osmdroid 3.0.7 on
Android 2.3.3 and Android 2.3.4

Please provide any additional information below.
The issue is valable for default map tiles but it's more(often) pronounced  on 
custom map tiles

if I change in MapView class in method dispatchDraw(final Canvas c) the 
following line:

/* Draw background */
c.drawColor(Color.LTGRAY);

the lines become less observable

Original issue reported on code.google.com by Prot0n4...@gmail.com on 15 Mar 2012 at 8:54

GoogleCodeExporter commented 9 years ago
Another work around is to expand the tile by 1 pixel in each direction before 
its drawn, this of course causes the tiles to overlap eliminating the scaling 
gap but the final render the tiles actually overlap

in TilesOverlay.java

    protected void onTileReadyToDraw(final Canvas c, final Drawable currentMapTile,
            final Rect tileRect) {
        tileRect.offset(-mWorldSize_2, -mWorldSize_2);
        currentMapTile.setBounds(tileRect.left - 1, tileRect.top - 1, tileRect.right + 1, tileRect.bottom + 1);
        currentMapTile.draw(c);
    }

For now I'm looking at instructing the tiles to overlap only when the map is 
being pinch zoomed and removing the overlap when rendered normally

such that the second line becomes:
        if (pinched)
            currentMapTile.setBounds(tileRect.left - 1, tileRect.top - 1, tileRect.right + 1, tileRect.bottom + 1);
        else
            currentMapTile.setBounds(tileRect);

Original comment by t...@chellew.co.uk on 5 Jul 2012 at 12:00

GoogleCodeExporter commented 9 years ago
Issue 381 has been merged into this issue.

Original comment by kurtzm...@gmail.com on 25 Jan 2013 at 8:20