Ticket #21315: 21315-2.patch
| File 21315-2.patch, 2.4 KB (added by , 5 years ago) |
|---|
-
src/org/openstreetmap/josm/plugins/buildings_tools/DrawBuildingAction.java
63 63 private Color selectedColor = Color.red; 64 64 private Point drawStartPos; 65 65 private Point mousePos; 66 /** Force a reasonable dimension */ 67 private static final double MIN_LEN_WIDTH = 1E-6; 66 68 67 69 final transient Building building = new Building(); 68 70 … … 243 245 EastNorth p = getEastNorth(); 244 246 if (isRectDrawing()) { 245 247 building.setPlaceRect(p); 248 if (building.getLength() < MIN_LEN_WIDTH) 249 return Mode.Drawing; 246 250 return shift ? Mode.DrawingAngFix : Mode.None; 247 251 } else if (ToolSettings.Shape.CIRCLE == ToolSettings.getShape()) { 248 252 if (ToolSettings.getWidth() != 0) { … … 250 254 } else { 251 255 building.setPlace(p, ToolSettings.getWidth(), ToolSettings.getLenStep(), shift); 252 256 } 257 if (building.getLength() < MIN_LEN_WIDTH) 258 return Mode.Drawing; 253 259 MainApplication.getMap().statusLine.setDist(building.getLength()); 254 this.nextMode = Mode.None; 255 return this.nextMode; 260 return Mode.None; 256 261 } else { 257 262 building.setPlace(p, ToolSettings.getWidth(), ToolSettings.getLenStep(), shift); 263 if (building.getLength() < MIN_LEN_WIDTH) 264 return Mode.Drawing; 258 265 MainApplication.getMap().statusLine.setDist(building.getLength()); 259 this.nextMode = ToolSettings.getWidth() == 0 ? Mode.DrawingWidth : Mode.None; 260 return this.nextMode; 266 return ToolSettings.getWidth() == 0 ? Mode.DrawingWidth : Mode.None; 261 267 } 262 268 } 263 269 264 270 private Mode modeDrawingWidth() { 265 271 building.setWidth(getEastNorth()); 266 MainApplication.getMap().statusLine.setDist(Math.abs(building.getWidth())); 267 return Mode.None; 272 double width = Math.abs(building.getWidth()); 273 MainApplication.getMap().statusLine.setDist(width); 274 return width < MIN_LEN_WIDTH ? Mode.DrawingWidth : Mode.None; 268 275 } 269 276 270 277 private Mode modeDrawingAngFix() {
