Position toolbox correctly at bottom

This commit is contained in:
Rachel Fenichel 2016-04-27 16:38:22 -07:00
parent cb1188af45
commit e596e23012
2 changed files with 3 additions and 5 deletions

View file

@ -415,10 +415,8 @@ Blockly.hideChaff = function(opt_allowToolbox) {
Blockly.getMainWorkspaceMetrics_ = function() {
var svgSize = Blockly.svgSize(this.getParentSvg());
if (this.toolbox_) {
// If the toolbox is at the bottom it's laid out separately from the main
// workspace, rather than overlapping, so we don't need to take its size
// into account.
if (this.toolboxPosition == Blockly.TOOLBOX_AT_TOP) {
if (this.toolboxPosition == Blockly.TOOLBOX_AT_TOP ||
this.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM) {
svgSize.height -= this.toolbox_.getHeight();
} else if (this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT ||
this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT) {

View file

@ -238,7 +238,7 @@ Blockly.Toolbox.prototype.position = function() {
if (this.toolboxPosition == Blockly.TOOLBOX_AT_TOP) { // Top
treeDiv.style.top = svgPosition.y + 'px';
} else { // Bottom
var topOfToolbox = svgPosition.y + svgSize.height;
var topOfToolbox = svgPosition.y + svgSize.height - treeDiv.offsetHeight;
treeDiv.style.top = topOfToolbox + 'px';
}
} else {