From 9107dc60c630faa73aae2f540010de8edaa96023 Mon Sep 17 00:00:00 2001 From: Shai Almog <67850168+shai-almog@users.noreply.github.com> Date: Wed, 24 Jul 2024 09:35:28 +0300 Subject: [PATCH] Fixed bias positioning logic 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. --- .../src/com/codename1/components/InteractionDialog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CodenameOne/src/com/codename1/components/InteractionDialog.java b/CodenameOne/src/com/codename1/components/InteractionDialog.java index 69af6ce078..ee29150c04 100644 --- a/CodenameOne/src/com/codename1/components/InteractionDialog.java +++ b/CodenameOne/src/com/codename1/components/InteractionDialog.java @@ -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; } }