Commit 75582660 authored by Neil Fraser's avatar Neil Fraser

Merge pull request #131 from carlosperate/menu_height

Contain the height of the field dropdown to the window viewport height.
parents 2201f165 3cc4c4e1
...@@ -547,6 +547,9 @@ Blockly.Css.CONTENT = [ ...@@ -547,6 +547,9 @@ Blockly.Css.CONTENT = [
' outline: none;', ' outline: none;',
' padding: 4px 0;', ' padding: 4px 0;',
' position: absolute;', ' position: absolute;',
' overflow-y: auto;',
' overflow-x: hidden;',
' max-height: 100%;',
' z-index: 20000;', /* Arbitrary, but some apps depend on it... */ ' z-index: 20000;', /* Arbitrary, but some apps depend on it... */
'}', '}',
......
...@@ -165,6 +165,8 @@ Blockly.FieldDropdown.prototype.showEditor_ = function() { ...@@ -165,6 +165,8 @@ Blockly.FieldDropdown.prototype.showEditor_ = function() {
Blockly.addClass_(menuDom, 'blocklyDropdownMenu'); Blockly.addClass_(menuDom, 'blocklyDropdownMenu');
// Record menuSize after adding menu. // Record menuSize after adding menu.
var menuSize = goog.style.getSize(menuDom); var menuSize = goog.style.getSize(menuDom);
// Recalculate height for the total content, not only box height.
menuSize.height = menuDom.scrollHeight;
// Position the menu. // Position the menu.
// Flip menu vertically if off the bottom. // Flip menu vertically if off the bottom.
......
...@@ -139,4 +139,5 @@ Blockly.WidgetDiv.position = function(anchorX, anchorY, windowSize, ...@@ -139,4 +139,5 @@ Blockly.WidgetDiv.position = function(anchorX, anchorY, windowSize,
} }
Blockly.WidgetDiv.DIV.style.left = anchorX + 'px'; Blockly.WidgetDiv.DIV.style.left = anchorX + 'px';
Blockly.WidgetDiv.DIV.style.top = anchorY + 'px'; Blockly.WidgetDiv.DIV.style.top = anchorY + 'px';
Blockly.WidgetDiv.DIV.style.height = windowSize.height - anchorY + 'px';
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment