Skip to content

Commit

Permalink
fix #20927 - ensure divider location remains between 0 and 1
Browse files Browse the repository at this point in the history
git-svn-id: https://josm.openstreetmap.de/svn/trunk@18298 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
don-vip committed Oct 31, 2021
1 parent ac124ce commit 9abe06f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,16 @@ private void adjustDividerLocation() {
int numTagDecisions = modelTagConflictResolver.getNumDecisions();
int numRelationDecisions = modelRelConflictResolver.getNumDecisions();


if (numTagDecisions > 0 && numRelationDecisions > 0 && getHeight() > 0) {
// see #12536: Take the space for buttons and checkbox into account.
double hPopup = getHeight();
double h1 = (pnlRelationMemberConflictResolver.getHeight() + pnlTagConflictResolver.getHeight());
double correction = h1 > 0 ? ((hPopup-h1)/hPopup) : 0;
double h1 = pnlRelationMemberConflictResolver.getHeight() + pnlTagConflictResolver.getHeight();
double correction = h1 > 0 && hPopup > h1 ? ((hPopup-h1)/hPopup) : 0;

double nTop = 3.5 + numTagDecisions;
double nBottom = 5.5 + numRelationDecisions;
spTagConflictTypes.setDividerLocation(nTop/(nTop+nBottom) - correction);
double ratio = nTop/(nTop+nBottom);
spTagConflictTypes.setDividerLocation(ratio > correction ? ratio - correction : ratio);
}
}

Expand Down

0 comments on commit 9abe06f

Please sign in to comment.