Ignore:
Timestamp:
2009-12-10T16:34:13+01:00 (15 years ago)
Author:
bastiK
Message:

some minor things:

  • layerlist dialog: right click on an entry selects it
  • geoimage dialog: add button on the lower right, that moves the window to the side pane
  • geoimage dialog: show image file name in the title
  • chained calling for ExtendedDialog
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r2592 r2602  
    133133            // To avoid issues when the user tries to zoom in on the image borders, this point is not calculated
    134134            // again if there was less than 1.5seconds since the last event.
    135             System.out.println(e);
    136135            if (e.getWhen() - lastTimeForMousePoint > 1500 || mousePointInImg == null) {
    137136                lastTimeForMousePoint = e.getWhen();
     
    535534
    536535    private Rectangle calculateDrawImageRectangle(Rectangle visibleRect) {
    537         Dimension size = getSize();
     536        return calculateDrawImageRectangle(visibleRect, new Rectangle(0, 0, getSize().width, getSize().height));
     537    }
     538   
     539    /**
     540     * calculateDrawImageRectangle
     541     *
     542     * @param imgRect the part of the image that should be drawn (in image coordinates)
     543     * @param compRect the part of the component where the image should be drawn (in component coordinates)
     544     * @return the part of compRect with the same width/height ratio as the image
     545     */
     546    static Rectangle calculateDrawImageRectangle(Rectangle imgRect, Rectangle compRect) {
    538547        int x, y, w, h;
    539548        x = 0;
    540549        y = 0;
    541         w = size.width;
    542         h = size.height;
    543 
    544         int wFact = w * visibleRect.height;
    545         int hFact = h * visibleRect.width;
     550        w = compRect.width;
     551        h = compRect.height;
     552
     553        int wFact = w * imgRect.height;
     554        int hFact = h * imgRect.width;
    546555        if (wFact != hFact) {
    547556            if (wFact > hFact) {
    548                 w = hFact / visibleRect.height;
    549                 x = (size.width - w) / 2;
     557                w = hFact / imgRect.height;
     558                x = (compRect.width - w) / 2;
    550559            } else {
    551                 h = wFact / visibleRect.width;
    552                 y = (size.height - h) / 2;
    553             }
    554         }
    555         return new Rectangle(x, y, w, h);
     560                h = wFact / imgRect.width;
     561                y = (compRect.height - h) / 2;
     562            }
     563        }
     564        return new Rectangle(x + compRect.x, y + compRect.y, w, h);
    556565    }
    557566
Note: See TracChangeset for help on using the changeset viewer.