File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -3582,12 +3582,15 @@ const piemenuGrid = (activity) => {
35823582 activity . turtles . gridWheel . clockwise = false ;
35833583 activity . turtles . gridWheel . initWheel ( grids ) ;
35843584 activity . turtles . gridWheel . createWheel ( ) ;
3585- activity . turtles . gridWheel . navigateWheel (
3586- activity . turtles . currentGrid ? activity . turtles . currentGrid : 0
3587- ) ;
3588-
3585+ const storedGrid = activity . turtles . currentGrid ?? 0 ;
3586+ activity . turtles . gridWheel . navigateWheel ( storedGrid ) ;
3587+
35893588 for ( let i = 0 ; i < gridLabels . length ; i ++ ) {
3590- activity . turtles . gridWheel . navItems [ i ] . navigateFunction = activity . turtles . doGrid ;
3589+ activity . turtles . gridWheel . navItems [ i ] . navigateFunction = function ( ) {
3590+ activity . hideGrids ( ) ;
3591+ activity . turtles . currentGrid = i ;
3592+ activity . turtles . doGrid ( i ) ;
3593+ } ;
35913594 activity . turtles . gridWheel . navItems [ i ] . setTooltip ( gridLabels [ i ] ) ;
35923595 }
35933596
Original file line number Diff line number Diff line change @@ -960,6 +960,10 @@ Turtles.TurtlesView = class {
960960 menuIcon . innerHTML = "menu" ;
961961 docById ( "toggleAuxBtn" ) . className -= "blue darken-1" ;
962962 }
963+ // Store the currently selected grid
964+ if ( this . activity . turtles . currentGrid !== undefined ) {
965+ this . selectedGrid = this . activity . turtles . currentGrid ;
966+ }
963967 this . _expandButton . style . visibility = "visible" ;
964968 this . _collapseButton . style . visibility = "hidden" ;
965969 this . gridButton . style . visibility = "hidden" ;
@@ -1049,6 +1053,15 @@ Turtles.TurtlesView = class {
10491053 this . gridButton . visible = true ;
10501054 }
10511055
1056+ // Restore the previously selected grid
1057+ if ( this . selectedGrid !== undefined ) {
1058+ this . activity . turtles . currentGrid = this . selectedGrid ;
1059+ this . activity . turtles . doGrid ( this . selectedGrid ) ;
1060+ } else {
1061+ this . activity . turtles . currentGrid = 0 ;
1062+ this . activity . turtles . doGrid ( 0 ) ;
1063+ }
1064+
10521065 // remove the stage and add it back in position 0
10531066 this . masterStage . removeChild ( turtlesStage ) ;
10541067 this . masterStage . addChildAt ( turtlesStage , 0 ) ;
You can’t perform that action at this time.
0 commit comments