Author: rwhitcomb
Date: Tue Aug 16 17:19:03 2016
New Revision: 1756534

URL: http://svn.apache.org/viewvc?rev=1756534&view=rev
Log:
PIVOT-990:  Fix the RepositionCallback logic in TerraMenuPopupSkin so that
a menu whose width or height is greater than the display width or height
will be positioned at 0 (X or Y as appropriate, or both), and whose
containing Border will be sized to the limiting display dimension.  This
allows the contained Panorama to automatically insert scroll arrows so
the menu that has overflowed can be scrolled into view.


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=1756534&r1=1756533&r2=1756534&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
 Tue Aug 16 17:19:03 2016
@@ -58,12 +58,20 @@ public class TerraMenuPopupSkin extends
             Dimensions size = menuPopup.getSize();
 
             int x = location.x;
-            if (x + size.width > display.getWidth()) {
+            int displayWidth = display.getWidth();
+            if (size.width > displayWidth) {
+                border.setPreferredWidth(displayWidth);
+                x = 0;
+            } else if (x + size.width > displayWidth) {
                 x -= size.width;
             }
 
             int y = location.y;
-            if (y + size.height > display.getHeight()) {
+            int displayHeight = display.getHeight();
+            if (size.height > displayHeight) {
+                border.setPreferredHeight(displayHeight);
+                y = 0;
+            } else if (y + size.height > displayHeight) {
                 y -= size.height;
             }
 


Reply via email to