Ticket #23392: 23392-2.patch

File 23392-2.patch, 1.9 KB (added by GerdP, 22 months ago)

use popup width, not screen width

  • src/org/openstreetmap/josm/gui/layer/AlignImageryPanel.java

     
    1111import javax.swing.JButton;
    1212import javax.swing.JCheckBox;
    1313import javax.swing.JPanel;
     14import javax.swing.SwingUtilities;
    1415import javax.swing.border.CompoundBorder;
    1516import javax.swing.border.EmptyBorder;
    1617import javax.swing.border.EtchedBorder;
     
    1920import org.openstreetmap.josm.data.preferences.BooleanProperty;
    2021import org.openstreetmap.josm.gui.MainApplication;
    2122import org.openstreetmap.josm.gui.MapFrame;
    22 import org.openstreetmap.josm.gui.util.GuiHelper;
    2323import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
    2424import org.openstreetmap.josm.gui.widgets.UrlLabel;
    2525import org.openstreetmap.josm.tools.GBC;
     
    8989    public static void addNagPanelIfNeeded(ImageryInfo infoToAdd) {
    9090        BooleanProperty showAgain = new BooleanProperty("message.imagery.nagPanel." + infoToAdd.getUrl(), true);
    9191        MapFrame map = MainApplication.getMap();
    92         if (MainApplication.isDisplayingMapView() && showAgain.get() && !infoToAdd.isGeoreferenceValid()
    93                 && map.getTopPanel(AlignImageryPanel.class) == null) {
    94             double w = GuiHelper.getScreenSize().getWidth();
    95             map.addTopPanel(new AlignImageryPanel(w > 1300, showAgain, infoToAdd));
     92        if (MainApplication.isDisplayingMapView() && Boolean.TRUE.equals(showAgain.get())
     93                && !infoToAdd.isGeoreferenceValid() && map.getTopPanel(AlignImageryPanel.class) == null) {
     94            SwingUtilities.invokeLater(() -> {
     95                double w = map.getWidth();
     96                map.addTopPanel(new AlignImageryPanel(w > 1300, showAgain, infoToAdd));
     97            });
    9698        }
    9799    }
    98100}