- Timestamp:
- 2015-04-18T01:35:39+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/AddNoteAction.java
r8056 r8210 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.event.KeyEvent; 6 7 import java.awt.event.MouseEvent; 7 8 8 9 import javax.swing.JOptionPane; 10 import javax.swing.SwingUtilities; 9 11 10 12 import org.openstreetmap.josm.Main; … … 15 17 import org.openstreetmap.josm.gui.Notification; 16 18 import org.openstreetmap.josm.gui.dialogs.NotesDialog; 19 import org.openstreetmap.josm.gui.util.KeyPressReleaseListener; 17 20 import org.openstreetmap.josm.tools.CheckParameterUtil; 18 21 import org.openstreetmap.josm.tools.ImageProvider; … … 22 25 * prompts the user for text and adds a note to the note layer 23 26 */ 24 public class AddNoteAction extends MapMode {27 public class AddNoteAction extends MapMode implements KeyPressReleaseListener { 25 28 26 29 private NoteData noteData; … … 48 51 super.enterMode(); 49 52 Main.map.mapView.addMouseListener(this); 53 Main.map.keyDetector.addKeyListener(this); 50 54 } 51 55 … … 54 58 super.exitMode(); 55 59 Main.map.mapView.removeMouseListener(this); 60 Main.map.keyDetector.removeKeyListener(this); 56 61 } 57 62 58 63 @Override 59 64 public void mouseClicked(MouseEvent e) { 65 if (!SwingUtilities.isLeftMouseButton(e)) { 66 // allow to pan without distraction 67 return; 68 } 60 69 Main.map.selectMapMode(Main.map.mapModeSelect); 61 70 LatLon latlon = Main.map.mapView.getLatLon(e.getPoint().x, e.getPoint().y); … … 77 86 } 78 87 } 88 89 @Override 90 public void doKeyPressed(KeyEvent e) { 91 if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { 92 Main.map.selectMapMode(Main.map.mapModeSelect); 93 } 94 } 95 96 @Override 97 public void doKeyReleased(KeyEvent e) { 98 } 79 99 }
Note:
See TracChangeset
for help on using the changeset viewer.