This repository was archived by the owner on Jul 24, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,8 @@ export const scratchWorkspaceInit = async (scratch_area_name, scratch_div_name)
4444
4545 const onWorkspaceResize = ( ) => {
4646 let el_scratch_area = document . getElementById ( scratch_area_name ) ;
47-
4847 const scratch_area = el_scratch_area ;
49- const scratch_div = document . getElementById ( scratch_div_name ) ;
48+ const el_scratch_div = document . getElementById ( scratch_div_name ) ;
5049
5150 let x = 0 ;
5251 let y = 0 ;
@@ -58,14 +57,17 @@ export const scratchWorkspaceInit = async (scratch_area_name, scratch_div_name)
5857 } while ( el_scratch_area ) ;
5958
6059 // Position scratch_div over scratch_area.
61- scratch_div . style . left = `${ x } px` ;
62- scratch_div . style . top = `${ y } px` ;
63- scratch_div . style . width = `${ scratch_area . offsetWidth } px` ;
64- scratch_div . style . height = `${ scratch_area . offsetHeight } px` ;
60+ el_scratch_div . style . left = `${ x } px` ;
61+ el_scratch_div . style . top = `${ y } px` ;
62+ el_scratch_div . style . width = `${ scratch_area . offsetWidth } px` ;
63+ el_scratch_div . style . height = `${ scratch_area . offsetHeight } px` ;
6564
6665 Blockly . svgResize ( workspace ) ;
6766 } ;
6867
68+ // Resize workspace on workspace event, workaround for jumping workspace.
69+ workspace . addChangeListener ( ( ) => Blockly . svgResize ( workspace ) ) ;
70+
6971 window . addEventListener ( 'resize' , onWorkspaceResize ) ;
7072 onWorkspaceResize ( ) ;
7173 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments