sanitize map scale input
This commit is contained in:
parent
e21831ceb9
commit
70e6266319
@ -499,6 +499,12 @@ public class MapViewPosition {
|
||||
*/
|
||||
public synchronized boolean scaleMap(float scale, float pivotX, float pivotY) {
|
||||
|
||||
// sanitize input
|
||||
if (scale < 0.5)
|
||||
scale = 0.5f;
|
||||
else if (scale > 2)
|
||||
scale = 2;
|
||||
|
||||
float newScale = mMapScale * scale;
|
||||
|
||||
int z = FastMath.log2((int) newScale);
|
||||
@ -599,10 +605,6 @@ public class MapViewPosition {
|
||||
mZoomLevel = MIN_ZOOMLEVEL;
|
||||
}
|
||||
|
||||
synchronized void setScale(float scale) {
|
||||
mScale = scale;
|
||||
}
|
||||
|
||||
private void updatePosition() {
|
||||
mPosX = MercatorProjection.longitudeToPixelX(mLongitude, mZoomLevel);
|
||||
mPosY = MercatorProjection.latitudeToPixelY(mLatitude, mZoomLevel);
|
||||
|
Loading…
x
Reference in New Issue
Block a user