mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Fix scrollbar positioning and category ordering
This commit is contained in:
parent
9d82bf3a18
commit
a4bdede170
3 changed files with 11 additions and 14 deletions
|
@ -456,7 +456,7 @@ Blockly.Css.CONTENT = [
|
|||
|
||||
'.blocklyTreeSeparatorHorizontal {',
|
||||
'border-right: solid #e5e5e5 1px;',
|
||||
'width: 0px;',
|
||||
'width: 0;',
|
||||
'padding: 5px 0;',
|
||||
'margin: 0 5px;',
|
||||
'}',
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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.
|
||||
// <sep></sep>
|
||||
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.
|
||||
// <sep gap="36"></sep>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue