From 28e298f2cd86977531333b069e0f8e85cef2fbcb Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Thu, 23 Jan 2020 14:23:25 -0800 Subject: [PATCH] Fix flyouts (#3645) * Set toolboxPosition after options have been parsed * Final toolbox position update --- core/mutator.js | 4 ++-- core/toolbox.js | 2 +- core/workspace_svg.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/mutator.js b/core/mutator.js index 0d2e31f7b..9971f26be 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -170,11 +170,11 @@ Blockly.Mutator.prototype.createEditor_ = function() { 'parentWorkspace': this.block_.workspace, 'media': this.block_.workspace.options.pathToMedia, 'rtl': this.block_.RTL, - 'toolboxPosition': this.block_.RTL ? Blockly.TOOLBOX_AT_RIGHT : - Blockly.TOOLBOX_AT_LEFT, 'horizontalLayout': false, 'renderer': this.block_.workspace.options.renderer })); + workspaceOptions.toolboxPosition = this.block_.RTL ? Blockly.TOOLBOX_AT_RIGHT : + Blockly.TOOLBOX_AT_LEFT; workspaceOptions.languageTree = quarkXml; workspaceOptions.getMetrics = this.getFlyoutMetrics_.bind(this); this.workspace_ = new Blockly.WorkspaceSvg(workspaceOptions); diff --git a/core/toolbox.js b/core/toolbox.js index 5cfbef845..c0a82d8ea 100644 --- a/core/toolbox.js +++ b/core/toolbox.js @@ -186,9 +186,9 @@ Blockly.Toolbox.prototype.init = function() { 'rtl': workspace.RTL, 'oneBasedIndex': workspace.options.oneBasedIndex, 'horizontalLayout': workspace.horizontalLayout, - 'toolboxPosition': workspace.options.toolboxPosition, 'renderer': workspace.options.renderer })); + workspaceOptions.toolboxPosition = workspace.options.toolboxPosition; if (workspace.horizontalLayout) { if (!Blockly.HorizontalFlyout) { diff --git a/core/workspace_svg.js b/core/workspace_svg.js index e0eb6b7e6..5e72f231a 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -899,9 +899,9 @@ Blockly.WorkspaceSvg.prototype.addFlyout = function(tagName) { 'rtl': this.RTL, 'oneBasedIndex': this.options.oneBasedIndex, 'horizontalLayout': this.horizontalLayout, - 'toolboxPosition': this.options.toolboxPosition, 'renderer': this.options.renderer })); + workspaceOptions.toolboxPosition = this.options.toolboxPosition; if (this.horizontalLayout) { if (!Blockly.HorizontalFlyout) { throw Error('Missing require for Blockly.HorizontalFlyout');