diff --git a/core/flyout_button.js b/core/flyout_button.js index d25052468..a766d54fc 100644 --- a/core/flyout_button.js +++ b/core/flyout_button.js @@ -203,6 +203,14 @@ Blockly.FlyoutButton.prototype.moveTo = function(x, y) { this.updateTransform_(); }; +/** + * Location of the button. + * @return {!goog.math.Coordinate} x, y coordinates. + */ +Blockly.FlyoutButton.prototype.getPosition = function() { + return this.position_; +}; + /** * Get the button's target workspace. * @return {!Blockly.WorkspaceSvg} The target workspace of the flyout where this diff --git a/core/flyout_vertical.js b/core/flyout_vertical.js index 21c5cdaab..32dc7969f 100644 --- a/core/flyout_vertical.js +++ b/core/flyout_vertical.js @@ -353,14 +353,23 @@ Blockly.VerticalFlyout.prototype.reflowInternal_ = function() { if (this.RTL) { // With the flyoutWidth known, right-align the blocks. var oldX = block.getRelativeToSurfaceXY().x; - var newX = flyoutWidth / this.workspace_.scale - this.MARGIN; - newX -= Blockly.BlockSvg.TAB_WIDTH; + var newX = flyoutWidth / this.workspace_.scale - this.MARGIN - + Blockly.BlockSvg.TAB_WIDTH; block.moveBy(newX - oldX, 0); } if (block.flyoutRect_) { this.moveRectToBlock_(block.flyoutRect_, block); } } + if (this.RTL) { + // With the flyoutWidth known, right-align the buttons. + for (var i = 0, button; button = this.buttons_[i]; i++) { + var y = button.getPosition().y; + var x = flyoutWidth - button.width - this.MARGIN - + Blockly.BlockSvg.TAB_WIDTH; + button.moveTo(x, y); + } + } // Record the width for .getMetrics_ and .position. this.width_ = flyoutWidth; // Call this since it is possible the trash and zoom buttons need