File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -3658,14 +3658,27 @@ const piemenuGrid = (activity) => {
36583658 activity . turtles . _exitWheel . createWheel ( [ "×" , " " ] ) ;
36593659
36603660 activity . turtles . _exitWheel . navItems [ 0 ] . navigateFunction = ( ) => {
3661- docById ( "wheelDivptm" ) . style . display = "none" ;
3662- activity . turtles . gridWheel . removeWheel ( ) ;
3663- activity . turtles . _exitWheel . removeWheel ( ) ;
3661+ hidePiemenu ( activity ) ;
36643662 } ;
36653663
36663664 if ( docById ( "helpfulWheelDiv" ) . style . display !== "none" ) {
36673665 docById ( "helpfulWheelDiv" ) . style . display = "none" ;
36683666 }
3667+
3668+ const hidePiemenu = ( activity ) => {
3669+ docById ( "wheelDivptm" ) . style . display = "none" ;
3670+ activity . turtles . gridWheel . removeWheel ( ) ;
3671+ activity . turtles . _exitWheel . removeWheel ( ) ;
3672+ } ;
3673+ const clickOutsideHandler = ( event ) => {
3674+ const piemenu = docById ( "wheelDivptm" ) ;
3675+ if ( ! piemenu . contains ( event . target ) ) {
3676+ hidePiemenu ( activity ) ;
3677+ document . removeEventListener ( "mousedown" , clickOutsideHandler ) ;
3678+ }
3679+ } ;
3680+
3681+ document . addEventListener ( "mousedown" , clickOutsideHandler ) ;
36693682} ;
36703683
36713684const piemenuKey = ( activity ) => {
@@ -4000,4 +4013,4 @@ const piemenuKey = (activity) => {
40004013 if ( j !== - 1 ) {
40014014 modenameWheel . navigateWheel ( j ) ;
40024015 }
4003- } ;
4016+ } ;
You can’t perform that action at this time.
0 commit comments