Ticket #18974: center-map-on-note.patch
File center-map-on-note.patch, 2.0 KB (added by , 14 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 putValue(NAME, tr("Center mapview on note")); 424 putValue(SHORT_DESCRIPTION, tr("Center mapview on note")); 425 new ImageProvider("dialogs/autoscale", "selection").getResource().attachImageIcon(this, true); 426 } 427 428 @Override 429 public void actionPerformed(ActionEvent e) { 430 MainApplication.getMap().mapView.zoomTo(noteData.getSelectedNote().getLatLon()); 431 } 432 } 433 434 /** 415 435 * Close a note 416 436 */ 417 437 class CloseAction extends JosmAction {