@@ -33,7 +33,7 @@ import {
3333} from './processing' ;
3434import { fromLonLat } from 'ol/proj' ;
3535import { Coordinate } from 'ol/coordinate' ;
36- import { targetWithCenterIcon } from './icons' ;
36+ import { pencilSolidIcon , targetWithCenterIcon } from './icons' ;
3737
3838interface ICreateEntry {
3939 tracker : JupyterGISTracker ;
@@ -878,6 +878,32 @@ export function addCommands(
878878 icon : targetWithCenterIcon
879879 } ) ;
880880
881+ commands . addCommand ( CommandIDs . newDrawVectorLayer , {
882+ label : trans . __ ( 'Create New Draw Vector Layer' ) ,
883+ isToggled : ( ) => {
884+ if ( tracker . currentWidget instanceof JupyterGISDocumentWidget ) {
885+ const model = tracker . currentWidget ?. content . currentViewModel
886+ . jGISModel as IJupyterGISModel ;
887+ return model . isDrawVectorLayerEnabled ;
888+ } else {
889+ return false ;
890+ }
891+ } ,
892+ execute : async ( ) => {
893+ if ( tracker . currentWidget instanceof JupyterGISDocumentWidget ) {
894+ const model = tracker . currentWidget ?. content . currentViewModel
895+ . jGISModel as IJupyterGISModel ;
896+ if ( model . isDrawVectorLayerEnabled === true ) {
897+ model . isDrawVectorLayerEnabled = false ;
898+ } else {
899+ model . isDrawVectorLayerEnabled = true ;
900+ }
901+ commands . notifyCommandChanged ( CommandIDs . newDrawVectorLayer ) ;
902+ }
903+ } ,
904+ icon : pencilSolidIcon
905+ } ) ;
906+
881907 loadKeybindings ( commands , keybindings ) ;
882908}
883909
0 commit comments