Closed angoca closed 1 year ago
Hi angoca,
what version of the plugin are you using?
notesolver (0.4.2)
I created a Trac issue to provide all the details: https://josm.openstreetmap.de/ticket/22371#ticket
With https://josm.openstreetmap.de/ticket/22307, a new popup for the "notes" window was added. The team will look into adding methods for adding entries into that menu.
Could you tell me whether the popup window always opens in the wrong place, no matter if you click the note on the map or in the "notes" window?
I attached 2 images. One when rich clicking on the note and the meny appears on the other screen. The second, when right clicking on the view, which appears in the same screen.
Same on WIndows. Laptop left, 2 screens right from it, JOSM on the most right screen. Clicking on the note - pupup appears on the most left screen - but in the right position :D If i move the map around and the note is on the bottom right, the popup apperars on the most left screen (laptop) on the bottom right. If i move the note somewhere else, the popup-position will change as well :D
But. the most left (Laptop) is marked as "Main" in Windows Settings.
It doesn't even need two screens. If you don't have JOSM maximized on the primary monitor the popup will appear out of place (presumably in desktop coordinates, not relative to the JOSM window). I'll look into it later and see whether I can fix it.
We're getting mouse coordinates relative to a component, but a context menu is shown in screen coordinates, at least when using setLocation
. So we have to convert the desired point to screen coordinates first. I can't test right now, but the following patch might solve it:
diff --git a/notesolver/src/main/java/org/openstreetmap/josm/plugins/notesolver/NoteSolverPlugin.java b/notesolver/src/main/java/org/openstreetmap/josm/plugins/notesolver/NoteSolverPlugin.java
index 6fda01d..ec654fa 100644
--- a/notesolver/src/main/java/org/openstreetmap/josm/plugins/notesolver/NoteSolverPlugin.java
+++ b/notesolver/src/main/java/org/openstreetmap/josm/plugins/notesolver/NoteSolverPlugin.java
@@ -159,8 +159,10 @@ public class NoteSolverPlugin extends Plugin {
JPopupMenu contextMenu = new JPopupMenu();
for (JMenuItem menuItem : mainMenuEntries(menuTypes.MAIN))
contextMenu.add(menuItem);
- Point p = MainApplication.getMainFrame().getMousePosition();
+ MainFrame frame = MainApplication.getMainFrame();
+ Point p = frame.getMousePosition();
if (p != null) {
+ SwingUtilities.convertPointToScreen(p, frame);
Component c = MainApplication.getMainFrame().getComponentAt(p);
JComponent jc = (JComponent)c;
if (c != null) {
I am using MacOS Catalina, with an external monitor (+ laptop monitor). When I click on a note, the popup appears in the laptop screen, even if JOSM is on the external monitor.