Ticket #14213: josm_buildings_tools_fix_cursor_v1.patch

File josm_buildings_tools_fix_cursor_v1.patch, 1.7 KB (added by Woazboat, 4 years ago)

Patch adding a new configuration option to always replace selection with new building (now with 100% fewer jar files in the diff)

  • plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/DrawBuildingAction.java

     
    5454
    5555    private final Cursor cursorJoinNode;
    5656    private final Cursor cursorJoinWay;
    57     private Cursor currCursor;
    5857    private Cursor customCursor;
    5958
    6059    private Mode mode = Mode.None;
     
    8079                // the actual cursor is drawn in enterMode()
    8180                ImageProvider.getCursor("crosshair", null));
    8281
    83         currCursor = getCursor();
    8482        cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode");
    8583        cursorJoinWay = ImageProvider.getCursor("crosshair", "joinway");
    8684    }
     
    104102     * @param c One of the available cursors
    105103     */
    106104    private void setCursor(final Cursor c) {
    107         if (currCursor.equals(c))
    108             return;
    109         try {
    110             // We invoke this to prevent strange things from happening
    111             EventQueue.invokeLater(() -> {
    112                 MapFrame map = MainApplication.getMap();
    113                 // Don't change cursor when mode has changed already
    114                 if (map == null || !(map.mapMode instanceof DrawBuildingAction))
    115                     return;
    116                 map.mapView.setCursor(c);
    117             });
    118             currCursor = c;
    119         } catch (Exception e) {
    120             Logging.error(e);
    121         }
     105        MainApplication.getMap().mapView.setNewCursor(c, this);
    122106    }
    123107
    124108    private void showAddrDialog(Way w) {