Changeset 16393 in josm for trunk/src/org


Ignore:
Timestamp:
2020-05-10T07:58:27+02:00 (5 years ago)
Author:
GerdP
Message:

fix #19181: Preference "Draw. Direction Arrows" looks ugly when zoomed out

  • only force the drawing of the final arrow when the way is selected
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r16253 r16393  
    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()) {
     
    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) {
Note: See TracChangeset for help on using the changeset viewer.