diff --git a/core/flyout.js b/core/flyout.js index 80a5e0de7..f980ce197 100644 --- a/core/flyout.js +++ b/core/flyout.js @@ -872,8 +872,8 @@ Blockly.Flyout.prototype.placeNewBlock_ = function(originBlock) { var scale = this.workspace_.scale; xyOld.x += scrollX / scale - scrollX; // If the flyout is on the right side, (0, 0) in the flyout is offset to - // the right of (0, 0) in the main workspace. Offset to take that into - // account. + // the right of (0, 0) in the main workspace. Add an offset to take that + // into account. if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_RIGHT) { scrollX = targetWorkspace.getMetrics().viewWidth - this.width_; scale = targetWorkspace.scale; @@ -889,7 +889,7 @@ Blockly.Flyout.prototype.placeNewBlock_ = function(originBlock) { scale = this.workspace_.scale; xyOld.y += scrollY / scale - scrollY; // If the flyout is on the bottom, (0, 0) in the flyout is offset to be below - // (0, 0) in the main workspace. Offset to take that into account. + // (0, 0) in the main workspace. Add an offset to take that into account. if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM) { scrollY = targetWorkspace.getMetrics().viewHeight - this.height_; scale = targetWorkspace.scale; diff --git a/core/inject.js b/core/inject.js index 419974c20..17bfccc0b 100644 --- a/core/inject.js +++ b/core/inject.js @@ -278,6 +278,7 @@ Blockly.init_ = function(mainWorkspace) { // Build a fixed flyout with the root blocks. mainWorkspace.flyout_.init(mainWorkspace); mainWorkspace.flyout_.show(options.languageTree.childNodes); + mainWorkspace.flyout_.scrollToStart(); // Translate the workspace sideways to avoid the fixed flyout. mainWorkspace.scrollX = mainWorkspace.flyout_.width_; if (options.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT) { diff --git a/tests/multi_playground.html b/tests/multi_playground.html index 8162b02c6..9cf4d3d7b 100644 --- a/tests/multi_playground.html +++ b/tests/multi_playground.html @@ -153,6 +153,11 @@ h1 { + + + + +