Fix shield rendering
This commit is contained in:
parent
56730f610f
commit
0b89a61d23
3 changed files with 13 additions and 8 deletions
|
@ -705,6 +705,8 @@ public class OsmandSettings {
|
|||
MAP_ZOOM_SCALE_BY_DENSITY.setModeDefaultValue(ApplicationMode.CAR, 0.5f);
|
||||
}
|
||||
|
||||
public final CommonPreference<Float> TEXT_SCALE = new FloatPreference("text_scale", 1f).makeGlobal().cache();
|
||||
|
||||
public float getSettingsZoomScale(float density){
|
||||
// by default scale between [0, 1[ density (because of lots map complains)
|
||||
return MAP_ZOOM_SCALE_BY_DENSITY.get() + (float)Math.sqrt(Math.max(0, density - 1));
|
||||
|
|
|
@ -676,8 +676,12 @@ public class MapRenderRepositories {
|
|||
currentRenderingContext.nightMode = nightMode;
|
||||
currentRenderingContext.preferredLocale = prefs.MAP_PREFERRED_LOCALE.get();
|
||||
currentRenderingContext.setDensityValue(mapDensity);
|
||||
currentRenderingContext.textScale = 1.0f; //Text/icon scales according to mapDensity
|
||||
// currentRenderingContext.textScale = 1 / mapDensity; //Text/icon stays same for all sizes
|
||||
//Text/icon scales according to mapDensity (so text is size of road)
|
||||
// currentRenderingContext.textScale = (requestedBox.getDensity()*app.getSettings().TEXT_SCALE.get());
|
||||
//Text/icon stays same for all sizes
|
||||
currentRenderingContext.textScale = (requestedBox.getDensity() * app.getSettings().TEXT_SCALE.get())
|
||||
/ mapDensity;
|
||||
|
||||
currentRenderingContext.screenDensityRatio = 1 / Math.max(1, requestedBox.getDensity()) ;
|
||||
// init rendering context
|
||||
currentRenderingContext.tileDivisor = tileDivisor;
|
||||
|
|
|
@ -250,15 +250,14 @@ public class TextRenderer {
|
|||
cv.drawTextOnPath(text.text, text.drawOnPath, 0, text.vOffset, paintText);
|
||||
} else {
|
||||
if (text.shieldRes != null) {
|
||||
float coef = rc.getDensityValue(rc.screenDensityRatio * rc.textScale);
|
||||
Bitmap ico = RenderingIcons.getIcon(context, text.shieldRes);
|
||||
if (ico != null) {
|
||||
float left = text.centerX - ico.getWidth() / 2 * rc.screenDensityRatio
|
||||
- 0.5f;
|
||||
float top = text.centerY - ico.getHeight() / 2 * rc.screenDensityRatio
|
||||
- rc.getDensityValue(4.5f);
|
||||
float left = text.centerX - ico.getWidth() / 2 * coef - 0.5f;
|
||||
float top = text.centerY - ico.getHeight() / 2 * coef - rc.getDensityValue(4.5f);
|
||||
if(rc.screenDensityRatio != 1f){
|
||||
RectF rf = new RectF(left, top, left + ico.getWidth() * rc.screenDensityRatio ,
|
||||
top + ico.getHeight() * rc.screenDensityRatio);
|
||||
RectF rf = new RectF(left, top, left + ico.getWidth() * coef,
|
||||
top + ico.getHeight() * coef);
|
||||
Rect src = new Rect(0, 0, ico.getWidth(), ico
|
||||
.getHeight());
|
||||
cv.drawBitmap(ico, src, rf, paintIcon);
|
||||
|
|
Loading…
Reference in a new issue