Fix issue with partial zooms
This commit is contained in:
parent
fc4cd3d762
commit
c268a1fce9
5 changed files with 19 additions and 7 deletions
|
@ -31,6 +31,7 @@ public class RenderingContext {
|
|||
public int height;
|
||||
|
||||
public int zoom;
|
||||
public float tileDivisor;
|
||||
public float rotate;
|
||||
|
||||
// debug purpose
|
||||
|
|
|
@ -86,7 +86,6 @@ public class OsmandRenderer {
|
|||
}
|
||||
|
||||
// use to calculate points
|
||||
float tileDivisor;
|
||||
PointF tempPoint = new PointF();
|
||||
float cosRotateTileSize;
|
||||
float sinRotateTileSize;
|
||||
|
|
|
@ -190,6 +190,11 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
private void drawZoomLevel(Canvas canvas) {
|
||||
String zoomText = view.getZoom() + "";
|
||||
float frac = view.getFloatZoom() - view.getZoom();
|
||||
while(frac > OsmandMapTileView.ZOOM_DELTA_1) {
|
||||
frac -= OsmandMapTileView.ZOOM_DELTA_1;
|
||||
zoomText += "'";
|
||||
}
|
||||
float length = zoomTextPaint.measureText(zoomText);
|
||||
if (zoomShadow.getBounds().width() == 0) {
|
||||
zoomShadow.setBounds(zoomInButton.getLeft() - 2, zoomInButton.getTop() - (int) (18 * scaleCoefficient), zoomInButton.getRight(),
|
||||
|
@ -303,11 +308,11 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (view.isZooming()) {
|
||||
activity.changeZoom(view.getZoom() + 2 );
|
||||
// activity.changeZoom(view.getFloatZoom() + 2 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
// activity.changeZoom(view.getZoom() + 2 );
|
||||
activity.changeZoom(view.getFloatZoom() + 2 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
} else {
|
||||
activity.changeZoom(view.getZoom() + 1 );
|
||||
// activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
// activity.changeZoom(view.getZoom() + 1 );
|
||||
activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -316,8 +321,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
zoomOutButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.changeZoom(view.getZoom() - 1 );
|
||||
// activity.changeZoom(view.getFloatZoom() - 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
// activity.changeZoom(view.getZoom() - 1 );
|
||||
activity.changeZoom(view.getFloatZoom() - 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -205,6 +205,10 @@ public:
|
|||
this->tileDivisor = (1 << (31 - z));
|
||||
}
|
||||
|
||||
void setTileDivisor(float tileDivisor) {
|
||||
this->tileDivisor = tileDivisor;
|
||||
}
|
||||
|
||||
void setDefaultColor(int z) {
|
||||
this->defaultColor = z;
|
||||
}
|
||||
|
|
|
@ -357,6 +357,7 @@ jfieldID jfield_RenderingContext_topY = NULL;
|
|||
jfieldID jfield_RenderingContext_width = NULL;
|
||||
jfieldID jfield_RenderingContext_height = NULL;
|
||||
jfieldID jfield_RenderingContext_zoom = NULL;
|
||||
jfieldID jfield_RenderingContext_tileDivisor = NULL;
|
||||
jfieldID jfield_RenderingContext_rotate = NULL;
|
||||
jfieldID jfield_RenderingContext_useEnglishNames = NULL;
|
||||
jfieldID jfield_RenderingContext_pointCount = NULL;
|
||||
|
@ -394,6 +395,7 @@ void loadJniRenderingContext(JNIEnv* env)
|
|||
jfield_RenderingContext_width = getFid(env, jclass_RenderingContext, "width", "I" );
|
||||
jfield_RenderingContext_height = getFid(env, jclass_RenderingContext, "height", "I" );
|
||||
jfield_RenderingContext_zoom = getFid(env, jclass_RenderingContext, "zoom", "I" );
|
||||
jfield_RenderingContext_tileDivisor = getFid(env, jclass_RenderingContext, "tileDivisor", "F" );
|
||||
jfield_RenderingContext_rotate = getFid(env, jclass_RenderingContext, "rotate", "F" );
|
||||
jfield_RenderingContext_useEnglishNames = getFid(env, jclass_RenderingContext, "useEnglishNames", "Z" );
|
||||
jfield_RenderingContext_pointCount = getFid(env, jclass_RenderingContext, "pointCount", "I" );
|
||||
|
@ -437,6 +439,7 @@ void pullFromJavaRenderingContext(JNIEnv* env, jobject jrc, JNIRenderingContext*
|
|||
rc->setDimension(env->GetIntField( jrc, jfield_RenderingContext_width ), env->GetIntField( jrc, jfield_RenderingContext_height ));
|
||||
|
||||
rc->setZoom(env->GetIntField( jrc, jfield_RenderingContext_zoom ));
|
||||
rc->setTileDivisor(env->GetFloatField( jrc, jfield_RenderingContext_tileDivisor ));
|
||||
rc->setRotate(env->GetFloatField( jrc, jfield_RenderingContext_rotate ));
|
||||
rc->setDensityScale(env->GetFloatField( jrc, jfield_RenderingContext_density ));
|
||||
rc->setShadowRenderingMode(env->GetIntField( jrc, jfield_RenderingContext_shadowRenderingMode ));
|
||||
|
|
Loading…
Reference in a new issue