Changeset 2519 in josm for trunk


Ignore:
Timestamp:
2009-11-27T12:57:56+01:00 (13 years ago)
Author:
stoecker
Message:

fixed 3660 - resize in slippy map downloader failed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java

    r2512 r2519  
    5353    // standard dimension
    5454    private Dimension iDownloadDialogDimension;
    55     // screen size
    56     private Dimension iScreenSize;
    5755
    5856    private TileSource[] sources = { new OsmTileSource.Mapnik(), new OsmTileSource.TilesAtHome(),
     
    240238     */
    241239    public void resizeSlippyMap() {
    242         if (iScreenSize == null) {
    243             Component c = iGui.getParent().getParent().getParent().getParent().getParent().getParent().getParent()
    244             .getParent().getParent();
    245             // remember the initial set screen dimensions
    246             iDownloadDialogDimension = c.getSize();
    247             // retrive the size of the display
    248             iScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
    249         }
    250 
    251         // resize
    252         Component co = iGui.getParent().getParent().getParent().getParent().getParent().getParent().getParent()
    253         .getParent().getParent();
    254         Dimension currentDimension = co.getSize();
    255 
     240        Dimension iScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
    256241        // enlarge
    257         if (currentDimension.equals(iDownloadDialogDimension)) {
     242        if(iDownloadDialogDimension == null) {
     243            iDownloadDialogDimension = iGui.getSize();
    258244            // make the each dimension 90% of the absolute display size and
    259245            // center the DownloadDialog
     246            // retrieve the size of the display
    260247            int w = iScreenSize.width * 90 / 100;
    261248            int h = iScreenSize.height * 90 / 100;
    262             co.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h);
    263 
     249            iGui.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h);
    264250        }
    265251        // shrink
     
    269255            int w = iDownloadDialogDimension.width;
    270256            int h = iDownloadDialogDimension.height;
    271             co.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h);
    272 
     257            iGui.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h);
     258            iDownloadDialogDimension = null;
    273259        }
    274260
Note: See TracChangeset for help on using the changeset viewer.