File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -290,18 +290,20 @@ function createProcedureCallbackFactory_(workspace) {
290
290
var blockDom = Blockly . utils . xml . textToDom ( blockText ) . firstChild ;
291
291
Blockly . Events . setGroup ( true ) ;
292
292
var block = Blockly . Xml . domToBlock ( blockDom , workspace ) ;
293
- var scale = workspace . scale ; // To convert from pixel units to workspace units
294
- // Position the block so that it is at the top left of the visible workspace,
295
- // padded from the edge by 30 units. Position in the top right if RTL.
296
- var posX = - workspace . scrollX ;
297
- if ( workspace . RTL ) {
298
- posX += workspace . getMetrics ( ) . contentWidth - 30 ;
299
- } else {
300
- posX += 30 ;
301
- }
302
- block . moveBy ( posX / scale , ( - workspace . scrollY + 30 ) / scale ) ;
303
- block . scheduleSnapAndBump ( ) ;
304
- Blockly . Events . setGroup ( false ) ;
293
+ Blockly . renderManagement . finishQueuedRenders ( ) . then ( ( ) => {
294
+ var scale = workspace . scale ; // To convert from pixel units to workspace units
295
+ // Position the block so that it is at the top left of the visible workspace,
296
+ // padded from the edge by 30 units. Position in the top right if RTL.
297
+ var posX = - workspace . scrollX ;
298
+ if ( workspace . RTL ) {
299
+ posX += workspace . getMetrics ( ) . contentWidth - 30 ;
300
+ } else {
301
+ posX += 30 ;
302
+ }
303
+ block . moveBy ( posX / scale , ( - workspace . scrollY + 30 ) / scale ) ;
304
+ block . scheduleSnapAndBump ( ) ;
305
+ Blockly . Events . setGroup ( false ) ;
306
+ } ) ;
305
307
}
306
308
} ;
307
309
}
You can’t perform that action at this time.
0 commit comments