Changeset 18298 in josm for trunk/src/org


Ignore:
Timestamp:
2021-10-31T20:55:53+01:00 (2 years ago)
Author:
Don-vip
Message:

fix #20927 - ensure divider location remains between 0 and 1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java

    r18208 r18298  
    447447        int numRelationDecisions = modelRelConflictResolver.getNumDecisions();
    448448
    449 
    450449        if (numTagDecisions > 0 && numRelationDecisions > 0 && getHeight() > 0) {
    451450            // see #12536: Take the space for buttons and checkbox into account.
    452451            double hPopup = getHeight();
    453             double h1 = (pnlRelationMemberConflictResolver.getHeight() + pnlTagConflictResolver.getHeight());
    454             double correction = h1 > 0 ? ((hPopup-h1)/hPopup) : 0;
     452            double h1 = pnlRelationMemberConflictResolver.getHeight() + pnlTagConflictResolver.getHeight();
     453            double correction = h1 > 0 && hPopup > h1 ? ((hPopup-h1)/hPopup) : 0;
    455454
    456455            double nTop = 3.5 + numTagDecisions;
    457456            double nBottom = 5.5 + numRelationDecisions;
    458             spTagConflictTypes.setDividerLocation(nTop/(nTop+nBottom) - correction);
     457            double ratio = nTop/(nTop+nBottom);
     458            spTagConflictTypes.setDividerLocation(ratio > correction ? ratio - correction : ratio);
    459459        }
    460460    }
Note: See TracChangeset for help on using the changeset viewer.