[mapguide-commits] r5915 - trunk/MgDev/Web/src/viewerfiles
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jun 3 10:32:18 EDT 2011
Author: jng
Date: 2011-06-03 07:32:18 -0700 (Fri, 03 Jun 2011)
New Revision: 5915
Modified:
trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
#1561: Use pre-existing text measuring logic to create an appropriately-sized toolbar flyout menu instead of one locked at 150px
Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ 2011-06-03 14:28:22 UTC (rev 5914)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ 2011-06-03 14:32:18 UTC (rev 5915)
@@ -1152,13 +1152,22 @@
function OpenFlyout(xpos, tbItemIndex)
{
var tbItem = parent.toolbarItems[tbItemIndex];
- tbMenu = new MenuData(tbItem.htmlElt, 20, 21, 50, 150,
+ var commands = parent.commands;
+ var items = tbItem.subItems;
+ var width = 150;
+ for(var i = 0; i < items.length; i++)
+ {
+ var item = items[i];
+ var cmd = commands[item.cmdIndex];
+ var hasIcon = (cmd.icon != null);
+ var w = parent.tbFrame.MeasureText(item.name) + (hasIcon? 42: 26);
+ if (w > width)
+ width = w;
+ }
+ tbMenu = new MenuData(tbItem.htmlElt, 20, 21, 50, width,
"../stdicons/icon_popupscrollup.gif", "../stdicons/icon_popupscrollup_disabled.gif", "../stdicons/icon_popupscrolldown.gif", "../stdicons/icon_popupscrolldown_disabled.gif",
parent, false, "#f0f0f0");
startBuildMenuContent(tbMenu);
-
- var commands = parent.commands;
- var items = tbItem.subItems;
for(var i = 0; i < items.length; i++)
{
var item = items[i];
More information about the mapguide-commits
mailing list