Ticket #18974: center-map-on-note-v2.patch
File center-map-on-note-v2.patch, 2.2 KB (added by , 23 months ago) |
---|
-
src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
80 80 private JList<Note> displayList; 81 81 private final JosmTextField filter = setupFilter(); 82 82 private final AddCommentAction addCommentAction; 83 private final CenterMapAction centerMapAction; 83 84 private final CloseAction closeAction; 84 85 private final DownloadNotesInViewAction downloadNotesInViewAction; 85 86 private final NewAction newAction; … … 96 97 Shortcut.registerShortcut("subwindow:notes", tr("Windows: {0}", tr("Notes")), 97 98 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), 150); 98 99 addCommentAction = new AddCommentAction(); 100 centerMapAction = new CenterMapAction(); 99 101 closeAction = new CloseAction(); 100 102 downloadNotesInViewAction = DownloadNotesInViewAction.newActionWithDownloadIcon(); 101 103 newAction = new NewAction(); … … 144 146 updateButtonStates(); 145 147 146 148 JPopupMenu notesPopupMenu = new JPopupMenu(); 149 notesPopupMenu.add(centerMapAction); 147 150 notesPopupMenu.add(addCommentAction); 148 151 notesPopupMenu.add(openInBrowserAction); 149 152 notesPopupMenu.add(closeAction); … … 412 415 } 413 416 414 417 /** 418 * Center the mapview on the note 419 * 420 */ 421 class CenterMapAction extends JosmAction { 422 CenterMapAction() { 423 super(tr("Center mapview on note"), "dialogs/position", tr("Center mapview on note"), 424 Shortcut.registerShortcut("notes:comment:center", tr("Notes: Center mapview on note"), KeyEvent.VK_UNDEFINED, Shortcut.NONE), 425 false, false); 426 } 427 428 @Override 429 public void actionPerformed(ActionEvent e) { 430 if (noteData != null && noteData.getSelectedNote() != null) { 431 MainApplication.getMap().mapView.zoomTo(noteData.getSelectedNote().getLatLon()); 432 } 433 } 434 } 435 436 /** 415 437 * Close a note 416 438 */ 417 439 class CloseAction extends JosmAction {