You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2017/10/02 17:32:58 UTC

svn commit: r1810561 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuPopupSkin.java

Author: rwhitcomb
Date: Mon Oct  2 17:32:58 2017
New Revision: 1810561

URL: http://svn.apache.org/viewvc?rev=1810561&view=rev
Log:
PIVOT-990: There was still a problem in the second code path: x/y + width/height
greater than display width/height.  So, set the x/y to the display width/height
minus the menu size, max with 0 so we don't go off the top/left.

This seems to work very well with all sizes of menu/display.

Modified:
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuPopupSkin.java

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuPopupSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuPopupSkin.java?rev=1810561&r1=1810560&r2=1810561&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuPopupSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuPopupSkin.java Mon Oct  2 17:32:58 2017
@@ -63,7 +63,7 @@ public class TerraMenuPopupSkin extends
                 border.setPreferredWidth(displayWidth);
                 x = 0;
             } else if (x + size.width > displayWidth) {
-                x -= size.width;
+                x = Math.max(displayWidth - size.width, 0);
             }
 
             int y = location.y;
@@ -72,7 +72,7 @@ public class TerraMenuPopupSkin extends
                 border.setPreferredHeight(displayHeight);
                 y = 0;
             } else if (y + size.height > displayHeight) {
-                y -= size.height;
+                y = Math.max(displayHeight - size.height, 0);
             }
 
             menuPopup.setLocation(x, y);