Skip to content

Commit 05fe1fb

Browse files
authored
Update xml.js
1 parent 58d7394 commit 05fe1fb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

core/xml.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ Blockly.Xml.variablesToDom = function(variableList) {
8686
*/
8787
Blockly.Xml.blockToDomWithXY = function(block, opt_noId) {
8888
var width; // Not used in LTR.
89-
if (block.workspace.RTL) {
89+
var isRTL = block.workspace ? block.workspace.RTL : false;
90+
if (isRTL) {
9091
width = block.workspace.getWidth();
9192
}
9293
var element = Blockly.Xml.blockToDom(block, opt_noId);
9394
var xy = block.getRelativeToSurfaceXY();
94-
element.setAttribute('x',
95-
Math.round(block.workspace.RTL ? width - xy.x : xy.x));
95+
element.setAttribute('x', Math.round(isRTL ? width - xy.x : xy.x));
9696
element.setAttribute('y', Math.round(xy.y));
9797
return element;
9898
};

0 commit comments

Comments
 (0)