@@ -355,7 +355,9 @@ class PageView {
355355 destroy ( canvasAndCtx ) {
356356 const idx = this . #alive. findIndex ( e => e . canvasAndCtx === canvasAndCtx ) ;
357357 if ( idx !== - 1 ) {
358- this . #alive[ idx ] . wrapper . remove ( ) ;
358+ const { wrapper, ctxLabel } = this . #alive[ idx ] ;
359+ wrapper . remove ( ) ;
360+ gfxStateComp . removeContext ( ctxLabel ) ;
359361 this . #alive. splice ( idx , 1 ) ;
360362 }
361363 super . destroy ( canvasAndCtx ) ;
@@ -393,7 +395,7 @@ class PageView {
393395 checker . className = "canvas-checker" ;
394396 checker . append ( canvasAndCtx . canvas ) ;
395397 wrapper . append ( labelEl , checker ) ;
396- const entry = { canvasAndCtx, wrapper, labelEl } ;
398+ const entry = { canvasAndCtx, wrapper, labelEl, ctxLabel } ;
397399 this . #alive. push ( entry ) ;
398400 this . #attachWrapper( entry ) ;
399401 }
@@ -482,7 +484,10 @@ class PageView {
482484 } ) ;
483485
484486 this . #stepButton. addEventListener ( "click" , ( ) => {
485- globalThis . StepperManager . _active ?. stepNext ( ) ;
487+ if ( globalThis . StepperManager . _active ) {
488+ this . #gfxStateComp. freeze ( ) ;
489+ globalThis . StepperManager . _active . stepNext ( ) ;
490+ }
486491 } ) ;
487492
488493 this . #continueButton. addEventListener ( "click" , ( ) => {
@@ -580,9 +585,11 @@ class PageView {
580585 }
581586 if ( e . key === "s" ) {
582587 e . preventDefault ( ) ;
588+ this . #gfxStateComp. freeze ( ) ;
583589 stepper . stepNext ( ) ;
584590 } else if ( e . key === "c" ) {
585591 e . preventDefault ( ) ;
592+ this . #gfxStateComp. freeze ( ) ;
586593 stepper . continueToBreakpoint ( ) ;
587594 }
588595 } ) ;
0 commit comments