From a4bdede170aec22703ac490695ceb8b67f271ea5 Mon Sep 17 00:00:00 2001 From: rachel-fenichel Date: Thu, 31 Mar 2016 13:05:21 -0700 Subject: [PATCH] Fix scrollbar positioning and category ordering --- core/css.js | 2 +- core/flyout.js | 8 +++++++- core/toolbox.js | 15 +++------------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/core/css.js b/core/css.js index e9facc8d0..6c09b9422 100644 --- a/core/css.js +++ b/core/css.js @@ -456,7 +456,7 @@ Blockly.Css.CONTENT = [ '.blocklyTreeSeparatorHorizontal {', 'border-right: solid #e5e5e5 1px;', - 'width: 0px;', + 'width: 0;', 'padding: 5px 0;', 'margin: 0 5px;', '}', diff --git a/core/flyout.js b/core/flyout.js index 25cc41c89..466b40609 100644 --- a/core/flyout.js +++ b/core/flyout.js @@ -246,10 +246,16 @@ Blockly.Flyout.prototype.getMetrics_ = function() { absoluteTop = 0; } var viewHeight = this.height_; + if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP) { + viewHeight += this.CORNER_RADIUS - this.SCROLLBAR_PADDING; + } var viewWidth = this.width_ - 2 * this.SCROLLBAR_PADDING; } else { var viewHeight = this.height_ - 2 * this.SCROLLBAR_PADDING; var viewWidth = this.width_; + if (!this.RTL) { + viewWidth -= this.SCROLLBAR_PADDING; + } } var metrics = { @@ -720,7 +726,7 @@ Blockly.Flyout.prototype.onMouseMove_ = function(e) { this.startDragMouseY_ = e.clientY; var metrics = this.getMetrics_(); var y = metrics.viewTop - dy; - y = goog.math.clamp(y, o, metrics.contentHeight - metrics.viewHeight); + y = goog.math.clamp(y, 0, metrics.contentHeight - metrics.viewHeight); this.scrollbar_.set(y); } }; diff --git a/core/toolbox.js b/core/toolbox.js index 568b98b60..26fd596e2 100644 --- a/core/toolbox.js +++ b/core/toolbox.js @@ -265,11 +265,7 @@ Blockly.Toolbox.prototype.populate_ = function(newTree) { case 'CATEGORY': var childOut = rootOut.createNode(childIn.getAttribute('name')); childOut.blocks = []; - if (that.horizontalLayout_) { - treeOut.add(childOut); - } else { - treeOut.addChildAt(childOut, 0); - } + treeOut.add(childOut); var custom = childIn.getAttribute('custom'); if (custom) { // Variables and procedures are special dynamic categories. @@ -303,13 +299,8 @@ Blockly.Toolbox.prototype.populate_ = function(newTree) { if (lastElement.tagName.toUpperCase() == 'CATEGORY') { // Separator between two categories. // - if (that.horizontalLayout_) { - treeOut.add(new Blockly.Toolbox.TreeSeparator( - that.treeSeparatorConfig_)); - } else { - treeOut.addChildAt(new Blockly.Toolbox.TreeSeparator( - that.treeSeparatorConfig_), 0); - } + treeOut.add(new Blockly.Toolbox.TreeSeparator( + that.treeSeparatorConfig_)); } else { // Change the gap between two blocks. //