Changeset 14985 in josm


Ignore:
Timestamp:
2019-04-11T15:38:25+02:00 (4 years ago)
Author:
GerdP
Message:

fix #17591 Zoom to download doesn't work as expected
Partly revert changes from r14628: don't enlarge area for "Zoom to download" or "Zoom to downloaded data"

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r14734 r14985  
    302302                break;
    303303            case DOWNLOAD:
    304                 modeDownload(new BoundingXYVisitor());
     304                modeDownload();
    305305                break;
    306306            }
     
    395395    }
    396396
    397     private void modeDownload(BoundingXYVisitor v) {
     397    private void modeDownload() {
    398398        if (lastZoomTime > 0 &&
    399399                System.currentTimeMillis() - lastZoomTime > Config.getPref().getLong("zoom.bounds.reset.time", TimeUnit.SECONDS.toMillis(10))) {
    400400            lastZoomTime = -1;
    401401        }
     402        Bounds bbox = null;
    402403        final DataSet dataset = getLayerManager().getActiveDataSet();
    403404        if (dataset != null) {
     
    407408                if (lastZoomTime == -1 || lastZoomArea == -1 || lastZoomArea > s) {
    408409                    lastZoomArea = s-1;
    409                     v.visit(dataSources.get(lastZoomArea).bounds);
     410                    bbox = dataSources.get(lastZoomArea).bounds;
    410411                } else if (lastZoomArea > 0) {
    411412                    lastZoomArea -= 1;
    412                     v.visit(dataSources.get(lastZoomArea).bounds);
     413                    bbox = dataSources.get(lastZoomArea).bounds;
    413414                } else {
    414415                    lastZoomArea = -1;
    415416                    Area sourceArea = getLayerManager().getActiveDataSet().getDataSourceArea();
    416417                    if (sourceArea != null) {
    417                         v.visit(new Bounds(sourceArea.getBounds2D()));
     418                        bbox = new Bounds(sourceArea.getBounds2D());
    418419                    }
    419420                }
     
    423424                lastZoomArea = -1;
    424425            }
    425         }
    426         MainApplication.getMap().mapView.zoomTo(v);
     426            if (bbox != null) {
     427                MainApplication.getMap().mapView.zoomTo(bbox);
     428            }
     429        }
    427430    }
    428431
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r14837 r14985  
    811811        if (viewport == null) return;
    812812        if (viewport.getBounds() != null) {
    813             BoundingXYVisitor v = new BoundingXYVisitor();
    814             v.visit(viewport.getBounds());
    815             zoomTo(v);
     813            zoomTo(viewport.getBounds());
    816814        } else {
    817815            zoomTo(viewport.getCenter(), viewport.getScale(), true);
Note: See TracChangeset for help on using the changeset viewer.