File tree Expand file tree Collapse file tree
packages/instrument-library/src/interactive/breakout-task Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,10 +12,15 @@ export default defineInstrument({
1212 render ( done ) {
1313 const startTime = Date . now ( ) ;
1414
15+ const wrapper = document . createElement ( 'div' ) ;
16+ wrapper . classList . add ( 'canvas-wrapper' ) ;
17+
1518 const canvas = document . createElement ( 'canvas' ) ;
1619 canvas . height = 320 ;
1720 canvas . width = 480 ;
18- document . body . appendChild ( canvas ) ;
21+
22+ wrapper . appendChild ( canvas ) ;
23+ document . body . appendChild ( wrapper ) ;
1924
2025 const ctx = canvas . getContext ( '2d' ) ! ;
2126 const ballRadius = 10 ;
Original file line number Diff line number Diff line change @@ -8,3 +8,11 @@ canvas {
88 display : block;
99 margin : 0 auto;
1010}
11+
12+ .canvas-wrapper {
13+ display : flex;
14+ justify-content : center;
15+ align-items : center;
16+ height : 100vh ;
17+ width : 100vw ;
18+ }
You can’t perform that action at this time.
0 commit comments