mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Merge pull request #273 from drigz/bugfix/fix-initial-scroll
Fix initial scroll position with fixed flyout
This commit is contained in:
commit
a21a7e6851
1 changed files with 12 additions and 5 deletions
|
@ -259,12 +259,19 @@ Blockly.init_ = function(mainWorkspace) {
|
|||
// Build a fixed flyout with the root blocks.
|
||||
mainWorkspace.flyout_.init(mainWorkspace);
|
||||
mainWorkspace.flyout_.show(options.languageTree.childNodes);
|
||||
// Translate the workspace sideways to avoid the fixed flyout.
|
||||
mainWorkspace.scrollX = mainWorkspace.flyout_.width_;
|
||||
if (options.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT) {
|
||||
mainWorkspace.scrollX *= -1;
|
||||
// Translate the workspace to avoid the fixed flyout.
|
||||
if (options.horizontalLayout) {
|
||||
mainWorkspace.scrollY = mainWorkspace.flyout_.height_;
|
||||
if (options.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM) {
|
||||
mainWorkspace.scrollY *= -1;
|
||||
}
|
||||
} else {
|
||||
mainWorkspace.scrollX = mainWorkspace.flyout_.width_;
|
||||
if (options.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT) {
|
||||
mainWorkspace.scrollX *= -1;
|
||||
}
|
||||
}
|
||||
mainWorkspace.translate(mainWorkspace.scrollX, 0);
|
||||
mainWorkspace.translate(mainWorkspace.scrollX, mainWorkspace.scrollY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue