FabianCoronel009 / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

Overlay with focus not properly adjusting to long titles #114

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create an overlay with focus with no description or a title longer than the 
description
2. *OR* adjust the font typeface or size for the title or description of an 
overlay

What is the expected output? What do you see instead?

I would expect the see the size of the overlay properly adjust to the title or 
the description,
whichever is longer.  What I see instead is that it always adjusts to the 
description length.

This is as of revision 494.

Please provide any additional information below.

The problem is that on line 230 of OpenStreetMapViewItemizedOverlayWithFocus, 
it supposed to be measuring the text width of the title, but it is measuring 
the text width of the description instead.  Changing the line to read:

final int titleWidth = (int) this.mTitlePaint.measureText(itemTitle);

will fix this problem.

Original issue reported on code.google.com by Biso.Shr...@gmail.com on 18 Nov 2010 at 4:48

GoogleCodeExporter commented 8 years ago
That change gives the same result. The issue is that the next line is

final int descWidth = Math.min(maxWidth, DESCRIPTION_MAXWIDTH);

where DESCRIPTION_MAXWIDTH is 200.

So basically it's designed that the width of the title shouldn't be more than 
200.

Original comment by neilboyd on 19 Nov 2010 at 10:57