Changeset 11931 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-04-16T20:45:20+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r11889 r11931 170 170 } 171 171 172 privateenum Polarity {172 enum Polarity { 173 173 NORTH(LatLon.NORTH_POLE), 174 174 SOUTH(LatLon.SOUTH_POLE); … … 180 180 } 181 181 182 privateLatLon getLatLon() {182 LatLon getLatLon() { 183 183 return latlon; 184 184 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r11848 r11931 142 142 @Override 143 143 public LayerPainter attachToMapView(MapViewEvent event) { 144 event.getMapView().addMouseListener(new MouseAdapter() { 145 @Override 146 public void mousePressed(MouseEvent e) { 147 if (e.getButton() != MouseEvent.BUTTON1) 148 return; 149 boolean mousePressedInButton = false; 150 for (Marker mkr : data) { 151 if (mkr.containsPoint(e.getPoint())) { 152 mousePressedInButton = true; 153 break; 154 } 155 } 156 if (!mousePressedInButton) 157 return; 158 mousePressed = true; 159 if (isVisible()) { 160 invalidate(); 161 } 162 } 163 164 @Override 165 public void mouseReleased(MouseEvent ev) { 166 if (ev.getButton() != MouseEvent.BUTTON1 || !mousePressed) 167 return; 168 mousePressed = false; 169 if (!isVisible()) 170 return; 171 for (Marker mkr : data) { 172 if (mkr.containsPoint(ev.getPoint())) { 173 mkr.actionPerformed(new ActionEvent(this, 0, null)); 174 } 175 } 176 invalidate(); 177 } 178 }); 144 event.getMapView().addMouseListener(new MarkerMouseAdapter()); 179 145 180 146 if (event.getMapView().playHeadMarker == null) { … … 475 441 } 476 442 443 private final class MarkerMouseAdapter extends MouseAdapter { 444 @Override 445 public void mousePressed(MouseEvent e) { 446 if (e.getButton() != MouseEvent.BUTTON1) 447 return; 448 boolean mousePressedInButton = false; 449 for (Marker mkr : data) { 450 if (mkr.containsPoint(e.getPoint())) { 451 mousePressedInButton = true; 452 break; 453 } 454 } 455 if (!mousePressedInButton) 456 return; 457 mousePressed = true; 458 if (isVisible()) { 459 invalidate(); 460 } 461 } 462 463 @Override 464 public void mouseReleased(MouseEvent ev) { 465 if (ev.getButton() != MouseEvent.BUTTON1 || !mousePressed) 466 return; 467 mousePressed = false; 468 if (!isVisible()) 469 return; 470 for (Marker mkr : data) { 471 if (mkr.containsPoint(ev.getPoint())) { 472 mkr.actionPerformed(new ActionEvent(this, 0, null)); 473 } 474 } 475 invalidate(); 476 } 477 } 478 477 479 public static final class ShowHideMarkerText extends AbstractAction implements LayerAction { 478 480 private final transient MarkerLayer layer;
Note:
See TracChangeset
for help on using the changeset viewer.