Skip to content

Commit

Permalink
Fixed bias positioning logic
Browse files Browse the repository at this point in the history
Bias positioning was calculated even when it was unnecessary. E.g. if available height is sufficient then we can just show the dialog based on the bias. However, this wasn't tested in the current code which always checked if there's more room for horizontally vs. vertically.
  • Loading branch information
shai-almog committed Jul 24, 2024
1 parent fd6752a commit 9107dc6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -761,11 +761,11 @@ public void showPopupDialog(Rectangle rect, boolean bias) {

// if we don't have enough space then disregard device orientation
if(showPortrait) {
if(availableHeight < (availableWidth - rect.getWidth()) / 2) {
if(availableHeight < prefHeight && availableHeight < (availableWidth - rect.getWidth()) / 2) {
showPortrait = false;
}
} else {
if(availableHeight / 2 > availableWidth - rect.getWidth()) {
if(availableWidth < prefWidth && availableHeight / 2 > availableWidth - rect.getWidth()) {
showPortrait = true;
}
}
Expand Down

0 comments on commit 9107dc6

Please sign in to comment.