Changeset 6035 in josm
- Timestamp:
- 2013-06-27T11:35:15+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r5835 r6035 5 5 import java.awt.BasicStroke; 6 6 import java.awt.Color; 7 import java.awt.Component; 7 8 import java.awt.Font; 8 9 import java.awt.FontMetrics; … … 28 29 import java.util.Iterator; 29 30 import java.util.List; 30 31 import javax.swing.AbstractButton; 32 import javax.swing.FocusManager; 31 33 import javax.swing.ImageIcon; 32 34 … … 319 321 320 322 private Collection<WaySegment> highlightWaySegments; 323 324 // highlight customization fields 325 private int highlightLineWidth; 326 private int highlightPointRadius; 327 private int widerHighlight; 328 private int highlightStep; 329 330 //flag that activate wider highlight mode 331 private boolean useWiderHighlight; 321 332 322 333 private boolean useStrokes; … … 331 342 public StyledMapRenderer(Graphics2D g, NavigatableComponent nc, boolean isInactiveMode) { 332 343 super(g, nc, isInactiveMode); 344 345 if (nc!=null) { 346 Component focusOwner = FocusManager.getCurrentManager().getFocusOwner(); 347 useWiderHighlight = !(focusOwner instanceof AbstractButton || focusOwner == nc); 348 } 333 349 } 334 350 … … 732 748 if (selected || member) 733 749 { 734 Color color = null;750 Color color; 735 751 if (isInactiveMode || n.isDisabled()) { 736 752 color = inactiveColor; … … 845 861 return; 846 862 g.setColor(highlightColorTransparent); 847 float w = (line.getLineWidth() + 4); 863 float w = (line.getLineWidth() + highlightLineWidth); 864 if (useWiderHighlight) w+=widerHighlight; 848 865 while(w >= line.getLineWidth()) { 849 866 g.setStroke(new BasicStroke(w, line.getEndCap(), line.getLineJoin(), line.getMiterLimit())); 850 867 g.draw(path); 851 w -= 4;868 w -= highlightStep; 852 869 } 853 870 } … … 858 875 private void drawPointHighlight(Point p, int size) { 859 876 g.setColor(highlightColorTransparent); 860 int s = size + 7; 877 int s = size + highlightPointRadius; 878 if (useWiderHighlight) s+=widerHighlight; 861 879 while(s >= size) { 862 880 int r = (int) Math.floor(s/2); 863 881 g.fillRoundRect(p.x-r, p.y-r, s, s, r, r); 864 s -= 4;865 } 866 } 867 882 s -= highlightStep; 883 } 884 } 885 868 886 public void drawRestriction(Image img, Point pVia, double vx, double vx2, double vy, double vy2, double angle, boolean selected) { 869 887 /* rotate image with direction last node in from to */ … … 966 984 967 985 /* find the "direct" nodes before the via node */ 968 Node fromNode = null;986 Node fromNode; 969 987 if(fromWay.firstNode() == via) { 970 988 fromNode = fromWay.getNode(1); … … 1305 1323 Main.pref.getBoolean("mappaint.use-antialiasing", true) ? 1306 1324 RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); 1325 1326 highlightLineWidth = Main.pref.getInteger("mappaint.highlight.width", 4); 1327 highlightPointRadius = Main.pref.getInteger("mappaint.highlight.radius", 7); 1328 widerHighlight = Main.pref.getInteger("mappaint.highlight.bigger-increment", 5); 1329 highlightStep = Main.pref.getInteger("mappaint.highlight.step", 4); 1307 1330 } 1308 1331
Note:
See TracChangeset
for help on using the changeset viewer.