From 5964278e7dd541f397c9862c61bdde3618f44b82 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 5 Apr 2018 18:16:05 -0700 Subject: [PATCH] Handle RTL --- core/workspace_svg.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/workspace_svg.js b/core/workspace_svg.js index c023554e6..f534ce45a 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -1515,10 +1515,13 @@ Blockly.WorkspaceSvg.prototype.centerOnBlock = function(id) { // Height/width is in workspace units. var heightWidth = block.getHeightWidth(); - // Center in workspace units. - var blockCenterX = xy.x + heightWidth.width / 2; + // Find the enter of the block in workspace units. var blockCenterY = xy.y + heightWidth.height / 2; + // In RTL the block's position is the top right of the block, not top left. + var multiplier = this.RTL ? -1 : 1; + var blockCenterX = xy.x + (multiplier * heightWidth.width / 2); + // Workspace scale, used to convert from workspace coordinates to pixels. var scale = this.scale;