From 94e0a7ff4cd8746a5dc94bef6eb0233ecaad1308 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Fri, 1 Jul 2016 13:42:17 -0700 Subject: [PATCH] Change params of flyout.layout --- core/flyout.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/flyout.js b/core/flyout.js index fdcfb1f68..e13bc48de 100644 --- a/core/flyout.js +++ b/core/flyout.js @@ -607,7 +607,9 @@ Blockly.Flyout.prototype.show = function(xmlList) { gaps.push(isNaN(gap) ? this.MARGIN * 3 : gap); } else if (tagName == 'BUTTON') { - contents.push({type: 'button', label: xml.getAttribute('text')}); + var label = xml.getAttribute('text'); + var curButton = new Blockly.FlyoutButton(this.workspace_, label); + contents.push({type: 'button', button: curButton}); gaps.push(this.MARGIN); } } @@ -645,7 +647,7 @@ Blockly.Flyout.prototype.show = function(xmlList) { /** * Lay out the blocks in the flyout. - * @param {!Array.} blocks The blocks to lay out. + * @param {!Array.} contents The blocks and buttons to lay out. * @param {!Array.} gaps The visible gaps between blocks. * @private */ @@ -695,7 +697,7 @@ Blockly.Flyout.prototype.layout_ = function(contents, gaps) { this.addBlockListeners_(root, block, rect); } else if (item.type == 'button') { - var button = new Blockly.FlyoutButton(this.workspace_, item.label); + var button = item.button; var buttonSvg = button.createDom(); button.moveTo(cursorX, cursorY); button.show();