Ticket #19887: 19887.2.patch

File 19887.2.patch, 2.5 KB (added by GerdP, 4 years ago)
  • src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

     
    163163        // super.enterMode() updates the status line and cursor so we need our state to be set correctly
    164164        setMode(Mode.NORMAL);
    165165        pWays = null;
    166 
     166        MainApplication.getMap().statusLine.setAutoLength(false);
    167167        super.enterMode();
    168168
    169169        mv.addMouseListener(this);
     
    186186        mv.removeTemporaryLayer(temporaryLayer);
    187187        MapFrame map = MainApplication.getMap();
    188188        map.statusLine.setDist(-1);
    189         map.statusLine.repaint();
     189        map.statusLine.setAutoLength(true);
    190190        map.keyDetector.removeModifierExListener(this);
    191191        removeWayHighlighting(sourceWays);
    192192        pWays = null;
     
    331331            } // else -> invalid modifier combination
    332332        } else if (mode == Mode.DRAGGING) {
    333333            clearSourceWays();
     334            MainApplication.getMap().statusLine.setDist(pWays.getWays());
    334335        }
    335336
    336337        setMode(Mode.NORMAL);
  • src/org/openstreetmap/josm/gui/MapStatus.java

     
    762762        }
    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.
    767770        try {
     
    11851188    }
    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();
    11901197            OsmPrimitive n1 = it.next();
     
    12631270            refreshDistText(event.getDataset().getSelected());
    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 xxx
     1278     */
     1279    public void setAutoLength(boolean b) {
     1280        autoLength = b;
     1281    }
     1282
     1283
    12661284}