Ticket #19181: 19181.patch

File 19181.patch, 2.0 KB (added by GerdP, 6 years ago)
  • src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

     
    13241324        Iterator<MapViewPoint> it = new OffsetIterator(mapState, wayNodes, offset);
    13251325        boolean initialMoveToNeeded = true;
    13261326        ArrowPaintHelper drawArrowHelper = null;
     1327        double minSegmentLenSq = 0;
    13271328        if (showOrientation) {
    13281329            drawArrowHelper = new ArrowPaintHelper(PHI, 10 + line.getLineWidth());
     1330            minSegmentLenSq = Math.pow(drawArrowHelper.getOnLineLength() * 1.3, 2);
    13291331        }
    13301332        while (it.hasNext()) {
    13311333            MapViewPoint p = it.next();
     
    13411343
    13421344                /* draw arrow */
    13431345                if (drawArrowHelper != null) {
    1344                     boolean drawArrow;
    1345                     // always draw last arrow - no matter how short the segment is
    1346                     drawArrow = !it.hasNext();
    1347                     if (!showHeadArrowOnly) {
    1348                         // draw arrows in between only if there is enough space
    1349                         drawArrow = drawArrow || p1.distanceToInView(p2) > drawArrowHelper.getOnLineLength() * 1.3;
     1346                    final boolean drawArrow;
     1347                    if (way.isSelected()) {
     1348                        // always draw last arrow - no matter how short the segment is
     1349                        drawArrow = !it.hasNext() || p1.distanceToInViewSq(p2) > minSegmentLenSq;
     1350                    } else {
     1351                        // not selected: only draw arrow when it fits
     1352                        drawArrow = (!showHeadArrowOnly || !it.hasNext()) && p1.distanceToInViewSq(p2) > minSegmentLenSq;
    13501353                    }
    13511354                    if (drawArrow) {
    13521355                        drawArrowHelper.paintArrowAt(orientationArrows, p2, p1);