[mapguide-commits] r5914 - branches/2.2/MgDev/Web/src/viewerfiles
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jun 3 10:28:22 EDT 2011
Author: jng
Date: 2011-06-03 07:28:22 -0700 (Fri, 03 Jun 2011)
New Revision: 5914
Modified:
branches/2.2/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: branches/2.2/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- branches/2.2/MgDev/Web/src/viewerfiles/ajaxmappane.templ 2011-06-03 13:24:59 UTC (rev 5913)
+++ branches/2.2/MgDev/Web/src/viewerfiles/ajaxmappane.templ 2011-06-03 14:28:22 UTC (rev 5914)
@@ -1102,13 +1102,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