Change text size and offset
This commit is contained in:
parent
c3931c7145
commit
b0bc772450
2 changed files with 16 additions and 7 deletions
|
@ -41,7 +41,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
IContextMenuProviderSelection, ContextMenuLayer.IMoveObjectProvider {
|
IContextMenuProviderSelection, ContextMenuLayer.IMoveObjectProvider {
|
||||||
|
|
||||||
protected static final int DIST_TO_SHOW = 80;
|
protected static final int DIST_TO_SHOW = 80;
|
||||||
private static final int TEXT_SIZE = 14;
|
private static final int TEXT_SIZE = 12;
|
||||||
private static final int VERTICAL_OFFSET = 10;
|
private static final int VERTICAL_OFFSET = 10;
|
||||||
|
|
||||||
private final MapActivity map;
|
private final MapActivity map;
|
||||||
|
|
|
@ -32,10 +32,11 @@ import gnu.trove.list.array.TIntArrayList;
|
||||||
|
|
||||||
public class RulerControlLayer extends OsmandMapLayer {
|
public class RulerControlLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private static final int VERTICAL_OFFSET = 10;
|
private static final int VERTICAL_OFFSET = 15;
|
||||||
private static final long DRAW_TIME = 2000;
|
private static final long DRAW_TIME = 2000;
|
||||||
private static final long DELAY_BEFORE_DRAW = 500;
|
private static final long DELAY_BEFORE_DRAW = 500;
|
||||||
private static final int TEXT_SIZE = 14;
|
private static final int TEXT_SIZE = 14;
|
||||||
|
private static final int DISTANCE_TEXT_SIZE = 16;
|
||||||
|
|
||||||
private final MapActivity mapActivity;
|
private final MapActivity mapActivity;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
|
@ -77,6 +78,8 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
private RenderingLineAttributes lineAttrs;
|
private RenderingLineAttributes lineAttrs;
|
||||||
private RenderingLineAttributes circleAttrs;
|
private RenderingLineAttributes circleAttrs;
|
||||||
private RenderingLineAttributes circleAttrsAlt;
|
private RenderingLineAttributes circleAttrsAlt;
|
||||||
|
private float circleTextSize;
|
||||||
|
private float lineTextSize;
|
||||||
|
|
||||||
private Handler handler;
|
private Handler handler;
|
||||||
|
|
||||||
|
@ -119,15 +122,16 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
lineAttrs = new RenderingLineAttributes("rulerLine");
|
lineAttrs = new RenderingLineAttributes("rulerLine");
|
||||||
|
|
||||||
float textSize = TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density;
|
circleTextSize = TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density;
|
||||||
|
lineTextSize = DISTANCE_TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density;
|
||||||
|
|
||||||
circleAttrs = new RenderingLineAttributes("rulerCircle");
|
circleAttrs = new RenderingLineAttributes("rulerCircle");
|
||||||
circleAttrs.paint2.setTextSize(textSize);
|
circleAttrs.paint2.setTextSize(circleTextSize);
|
||||||
circleAttrs.paint3.setTextSize(textSize);
|
circleAttrs.paint3.setTextSize(circleTextSize);
|
||||||
|
|
||||||
circleAttrsAlt = new RenderingLineAttributes("rulerCircleAlt");
|
circleAttrsAlt = new RenderingLineAttributes("rulerCircleAlt");
|
||||||
circleAttrsAlt.paint2.setTextSize(textSize);
|
circleAttrsAlt.paint2.setTextSize(circleTextSize);
|
||||||
circleAttrsAlt.paint3.setTextSize(textSize);
|
circleAttrsAlt.paint3.setTextSize(circleTextSize);
|
||||||
|
|
||||||
handler = new Handler() {
|
handler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -219,6 +223,8 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
updateData(tb, center);
|
updateData(tb, center);
|
||||||
RenderingLineAttributes attrs;
|
RenderingLineAttributes attrs;
|
||||||
if (mode == RulerMode.FIRST) {
|
if (mode == RulerMode.FIRST) {
|
||||||
|
circleAttrs.paint2.setTextSize(circleTextSize);
|
||||||
|
circleAttrs.paint3.setTextSize(circleTextSize);
|
||||||
attrs = circleAttrs;
|
attrs = circleAttrs;
|
||||||
} else {
|
} else {
|
||||||
attrs = circleAttrsAlt;
|
attrs = circleAttrsAlt;
|
||||||
|
@ -263,6 +269,9 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
circleAttrs.paint2.getTextBounds(text, 0, text.length(), bounds);
|
circleAttrs.paint2.getTextBounds(text, 0, text.length(), bounds);
|
||||||
float hOffset = pm.getLength() / 2 - bounds.width() / 2;
|
float hOffset = pm.getLength() / 2 - bounds.width() / 2;
|
||||||
|
|
||||||
|
circleAttrs.paint2.setTextSize(lineTextSize);
|
||||||
|
circleAttrs.paint3.setTextSize(lineTextSize);
|
||||||
|
|
||||||
if (x1 >= x2) {
|
if (x1 >= x2) {
|
||||||
float[] pos = new float[2];
|
float[] pos = new float[2];
|
||||||
pm.getPosTan(pm.getLength() / 2, pos, null);
|
pm.getPosTan(pm.getLength() / 2, pos, null);
|
||||||
|
|
Loading…
Reference in a new issue