Fix dropdowns on scrolled pages. Issue 183.

This commit is contained in:
Neil Fraser
2015-09-24 14:53:29 -07:00
parent 33a0cc98de
commit 8beffc6c33
3 changed files with 8 additions and 6 deletions

View File

@@ -174,7 +174,7 @@ Blockly.FieldDropdown.prototype.showEditor_ = function() {
// Flip menu vertically if off the bottom.
if (xy.y + menuSize.height + borderBBox.height >=
windowSize.height + scrollOffset.y) {
xy.y -= menuSize.height;
xy.y -= menuSize.height + 2;
} else {
xy.y += borderBBox.height;
}

View File

@@ -87,6 +87,7 @@ Blockly.WidgetDiv.hide = function() {
Blockly.WidgetDiv.DIV.style.display = 'none';
Blockly.WidgetDiv.DIV.style.left = '';
Blockly.WidgetDiv.DIV.style.top = '';
Blockly.WidgetDiv.DIV.style.height = '';
Blockly.WidgetDiv.dispose_ && Blockly.WidgetDiv.dispose_();
Blockly.WidgetDiv.owner_ = null;
Blockly.WidgetDiv.dispose_ = null;
@@ -129,7 +130,7 @@ Blockly.WidgetDiv.position = function(anchorX, anchorY, windowSize,
anchorY = scrollOffset.y;
}
if (rtl) {
// Don't let the menu go right of the right edge of the window.
// Don't let the widget go right of the right edge of the window.
if (anchorX > windowSize.width + scrollOffset.x) {
anchorX = windowSize.width + scrollOffset.x;
}
@@ -141,5 +142,6 @@ Blockly.WidgetDiv.position = function(anchorX, anchorY, windowSize,
}
Blockly.WidgetDiv.DIV.style.left = anchorX + 'px';
Blockly.WidgetDiv.DIV.style.top = anchorY + 'px';
Blockly.WidgetDiv.DIV.style.height = windowSize.height - anchorY + 'px';
Blockly.WidgetDiv.DIV.style.height =
(windowSize.height - anchorY + scrollOffset.y) + 'px';
};