Fix blank tiles on large windows and tilt (#522)

This commit is contained in:
Gustl22
2018-04-12 11:09:56 +02:00
committed by Emux
parent 7aac624ec7
commit d1f9a4e8f6
6 changed files with 76 additions and 8 deletions

View File

@@ -217,8 +217,9 @@ public class TileManager {
mTilesEnd = 0;
mTilesCount = 0;
/* set up TileSet large enough to hold current tiles */
int num = Math.max(mMap.getWidth(), mMap.getHeight());
/* Set up TileSet large enough to hold current tiles.
* Use screen size as workaround for blank tiles in #520. */
int num = Math.max(mMap.getScreenWidth(), mMap.getScreenHeight());
int size = Tile.SIZE >> 1;
int numTiles = (num * num) / (size * size) * 4;

View File

@@ -2,8 +2,9 @@
* Copyright 2013 Hannes Janetzek
* Copyright 2016 Andrey Novikov
* Copyright 2016 Stephan Leuschner
* Copyright 2016-2017 devemux86
* Copyright 2016-2018 devemux86
* Copyright 2016 Longri
* Copyright 2018 Gustl22
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -272,15 +273,25 @@ public abstract class Map implements TaskQueue {
}
/**
* Return screen width in pixel.
* Return view width in pixel.
*/
public abstract int getWidth();
/**
* Return screen height in pixel.
* Return view height in pixel.
*/
public abstract int getHeight();
/**
* Return screen width in pixel.
*/
public abstract int getScreenWidth();
/**
* Return screen height in pixel.
*/
public abstract int getScreenHeight();
/**
* Request to clear all layers before rendering next frame
*/

View File

@@ -42,6 +42,8 @@ public class Viewport {
public final static int MAX_ZOOM_LEVEL = 20;
public final static int MIN_ZOOM_LEVEL = 2;
public final static float MIN_TILT = 0;
/* Note: limited by numTiles in TileManager to ~80° */
public final static float MAX_TILT = 65;
protected double mMaxScale = (1 << MAX_ZOOM_LEVEL);