Changeset 5378 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2012-07-28T21:41:33+02:00 (12 years ago)
Author:
bastiK
Message:

fixed #7032 - can't easily add tags to recently drawn way

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

Legend:

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

    r5282 r5378  
    11711171        }
    11721172        return rv;
     1173    }
     1174
     1175    /**
     1176     * Get selected primitives, while draw action is in progress.
     1177     *
     1178     * While drawing a way, technically the last node is selected.
     1179     * This is inconvenient when the user tries to add tags to the
     1180     * way using a keyboard shortcut. In that case, this method returns
     1181     * the current way as selection, to work around this issue.
     1182     * Otherwise the normal selection of the current data layer is returned.
     1183     */
     1184    public Collection<OsmPrimitive> getInProgressSelection() {
     1185        DataSet ds = getCurrentDataSet();
     1186        if (ds == null) return null;
     1187        if (currentBaseNode != null && !ds.getSelected().isEmpty()) {
     1188            Way continueFrom = getWayForNode(currentBaseNode);
     1189            if (alt && continueFrom != null) {
     1190                return Collections.<OsmPrimitive>singleton(continueFrom);
     1191            }
     1192        }
     1193        return ds.getSelected();
    11731194    }
    11741195
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r5327 r5378  
    7474import org.openstreetmap.josm.Main;
    7575import org.openstreetmap.josm.actions.JosmAction;
     76import org.openstreetmap.josm.actions.mapmode.DrawAction;
    7677import org.openstreetmap.josm.actions.search.SearchAction.SearchMode;
    7778import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting;
     
    462463     */
    463464    void add() {
    464         DataSet ds = Main.main.getCurrentDataSet();
    465         if (ds == null) return;
    466         Collection<OsmPrimitive> sel = ds.getSelected();
     465        Collection<OsmPrimitive> sel;
     466        if (Main.map.mapMode instanceof DrawAction) {
     467            sel = ((DrawAction) Main.map.mapMode).getInProgressSelection();
     468        } else {
     469            DataSet ds = Main.main.getCurrentDataSet();
     470            if (ds == null) return;
     471            sel = ds.getSelected();
     472        }
    467473        if (sel.isEmpty()) return;
    468474
Note: See TracChangeset for help on using the changeset viewer.