Changeset 17108 in josm for trunk/src/org


Ignore:
Timestamp:
2020-10-08T09:56:37+02:00 (4 years ago)
Author:
GerdP
Message:

fix #19887: Parallel ways tool: bottom toolbar unusable to view offset measurement

  • implememt new method MapStatus.setAutoLength()
  • ParallelWayAction calls it with false in enterMode()
  • call it in MapMode.enterMode() to make sure that it is reenabled even if ParallelWayAction.exitMode() is not called.
Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

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

    r16553 r17108  
    7474        readPreferences();
    7575        MainApplication.getMap().mapView.setNewCursor(cursor, this);
     76        MainApplication.getMap().statusLine.setAutoLength(true);
    7677        updateStatusLine();
    7778    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r16119 r17108  
    164164        setMode(Mode.NORMAL);
    165165        pWays = null;
    166 
    167166        super.enterMode();
     167
     168        // #19887: overwrite default: we want to show the distance to the original way
     169        MainApplication.getMap().statusLine.setAutoLength(false);
    168170
    169171        mv.addMouseListener(this);
     
    187189        MapFrame map = MainApplication.getMap();
    188190        map.statusLine.setDist(-1);
    189         map.statusLine.repaint();
     191        map.statusLine.setAutoLength(true);
    190192        map.keyDetector.removeModifierExListener(this);
    191193        removeWayHighlighting(sourceWays);
     
    332334        } else if (mode == Mode.DRAGGING) {
    333335            clearSourceWays();
     336            MainApplication.getMap().statusLine.setDist(pWays.getWays());
    334337        }
    335338
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r17058 r17108  
    763763    };
    764764
     765    /** see #19887: determine if the {@code distValue} field should be filled with length of selected object */
     766    private boolean autoLength = true;
     767
    765768    private void registerListeners() {
    766769        // Listen to keyboard/mouse events for pressing/releasing alt key and inform the collector.
     
    11861189
    11871190    private void refreshDistText(Collection<? extends OsmPrimitive> newSelection) {
     1191        if (!autoLength) {
     1192            return;
     1193        }
     1194
    11881195        if (newSelection.size() == 2) {
    11891196            Iterator<? extends OsmPrimitive> it = newSelection.iterator();
     
    12641271        }
    12651272    }
     1273
     1274    /**
     1275     * Enable or disable the automatic refresh of the length field.
     1276     * @param b if {@code true} the automatic refresh is enabled, else disabled
     1277     * @since 17108
     1278     */
     1279    public void setAutoLength(boolean b) {
     1280        autoLength = b;
     1281    }
     1282
     1283
    12661284}
Note: See TracChangeset for help on using the changeset viewer.