Ticket #23654: josm_23654.patch
File josm_23654.patch, 3.3 KB (added by , 10 months ago) |
---|
-
src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java
69 69 // Draw terms of use text 70 70 int termsTextHeight = 0; 71 71 int termsTextY = height; 72 int padding = 5; 72 73 73 74 if (attrTermsText != null) { 74 75 Rectangle2D termsStringBounds = g.getFontMetrics().getStringBounds(attrTermsText, g); 75 76 int textRealHeight = (int) termsStringBounds.getHeight(); 76 termsTextHeight = textRealHeight - 5;77 termsTextHeight = textRealHeight - padding; 77 78 int termsTextWidth = (int) termsStringBounds.getWidth(); 78 79 termsTextY = height - termsTextHeight; 79 80 int x = 2; 80 81 int y = height - termsTextHeight; 81 attrToUBounds = new Rectangle(x, y-termsTextHeight, termsTextWidth, textRealHeight); 82 g.setColor(Color.black); 83 g.drawString(attrTermsText, x + 1, y + 1); 84 g.setColor(Color.white); 85 g.drawString(attrTermsText, x, y); 82 attrToUBounds = new Rectangle(x, y - termsTextHeight, termsTextWidth, textRealHeight); 83 drawShadedText(g, attrTermsText, x, y); 86 84 } else { 87 85 attrToUBounds = null; 88 86 } … … 102 100 g.setFont(ATTR_FONT); 103 101 String attributionText = source.getAttributionText(zoom, topLeft, bottomRight); 104 102 if (attributionText == null) { 105 // In case attribution text has been forgotte, display URL103 // In case the attribution text has been forgotten, display URL 106 104 attributionText = source.getAttributionLinkURL(); 107 105 } 108 106 if (attributionText != null) { 109 107 Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(attributionText, g); 110 int textHeight = (int) stringBounds.getHeight() - 5; 111 int x = width - (int) stringBounds.getWidth(); 108 int textHeight = (int) stringBounds.getHeight() - padding; 109 int textWidth = (int) stringBounds.getWidth() + padding; 110 int x = width - textWidth; 112 111 int y = height - textHeight; 113 g.setColor(Color.black); 114 g.drawString(attributionText, x + 1, y + 1); 115 g.setColor(Color.white); 116 g.drawString(attributionText, x, y); 117 attrTextBounds = new Rectangle(x, y-textHeight, (int) stringBounds.getWidth(), (int) stringBounds.getHeight()); 112 drawShadedText(g, attributionText, x, y); 113 attrTextBounds = new Rectangle(x, y - textHeight, (int) stringBounds.getWidth(), (int) stringBounds.getHeight()); 118 114 } else { 119 115 attrTextBounds = null; 120 116 } … … 122 118 g.setFont(font); 123 119 } 124 120 121 private static void drawShadedText(Graphics g, String text, int x, int y) { 122 g.setColor(Color.black); 123 g.drawString(text, x + 1, y + 1); 124 g.setColor(Color.white); 125 g.drawString(text, x, y); 126 } 127 125 128 public boolean handleAttributionCursor(Point p) { 126 129 if (attrTextBounds != null && attrTextBounds.contains(p)) { 127 130 return true;