@@ -3652,20 +3652,34 @@ const piemenuGrid = (activity) => {
36523652 activity . turtles . _exitWheel . slicePathCustom . minRadiusPercent = 0.0 ;
36533653 activity . turtles . _exitWheel . slicePathCustom . maxRadiusPercent = 0.3 ;
36543654 activity . turtles . _exitWheel . sliceSelectedPathCustom =
3655- activity . turtles . _exitWheel . slicePathCustom ;
3655+ activity . turtles . _exitWheel . slicePathCustom ;
36563656 activity . turtles . _exitWheel . sliceInitPathCustom = activity . turtles . _exitWheel . slicePathCustom ;
36573657 activity . turtles . _exitWheel . clickModeRotate = false ;
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+
3674+ const clickOutsideHandler = ( event ) => {
3675+ const piemenu = docById ( "wheelDivptm" ) ;
3676+ if ( ! piemenu . contains ( event . target ) ) {
3677+ hidePiemenu ( activity ) ;
3678+ document . removeEventListener ( "mousedown" , clickOutsideHandler ) ;
3679+ }
3680+ } ;
3681+
3682+ document . addEventListener ( "mousedown" , clickOutsideHandler ) ;
36693683} ;
36703684
36713685const piemenuKey = ( activity ) => {
@@ -4000,4 +4014,4 @@ const piemenuKey = (activity) => {
40004014 if ( j !== - 1 ) {
40014015 modenameWheel . navigateWheel ( j ) ;
40024016 }
4003- } ;
4017+ } ;
0 commit comments