myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1455528 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
Date Tue, 12 Mar 2013 13:39:42 GMT
Author: lofwyr
Date: Tue Mar 12 13:39:42 2013
New Revision: 1455528

URL: http://svn.apache.org/r1455528
Log:
TOBAGO-1240: Submenu under the boxmenu is on the right side and paint outside the view.

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js?rev=1455528&r1=1455527&r2=1455528&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
Tue Mar 12 13:39:42 2013
@@ -130,23 +130,26 @@ Tobago.Menu.open = function(event) {
   // open sub menu
   if (sub.size() > 0) {
     // compute position
-    // XXX Todo: "compute position" is not perfect! Should be enhanced, especially for sub
menus.
-    // XXX The problem is, when the menu opens at the edge of the visual window.
     var left;
     var top;
+    var page = jQuery(".tobago-page-content:first");
     if (li.hasClass('tobago-menu-markup-top')) {
       // is top menu
       left = li.offset().left;
       top = li.offset().top + li.outerHeight();
       // fix menu position, when it is outside of the current page
-      var page = jQuery(".tobago-page-content:first");
       left = Math.max(0, Math.min(left, page.outerWidth() - sub.outerWidth()));
       top = Math.max(0, Math.min(top, page.outerHeight() - sub.outerHeight()));
     } else {
       // is sub menu
-      left = li.position().left + li.outerWidth();
+      // fix menu position, when it is outside of the current page
+      if (li.offset().left + li.outerWidth() + sub.outerWidth() <= page.outerWidth())
{
+        left = li.position().left + li.outerWidth();
+      } else {
+        left = -sub.outerWidth();
+      }
       top = li.position().top - 1; // 1 = border-top
-      // XXX todo: fix sub menu position, when it is outside of the page
+      top = Math.min(top, page.outerHeight() - sub.outerHeight() + top - li.offset().top);
     }
     sub.css('left', left);
     sub.css('top', top);



Mime
View raw message