@@ -33,7 +33,7 @@ import {
33
33
} from './processing' ;
34
34
import { fromLonLat } from 'ol/proj' ;
35
35
import { Coordinate } from 'ol/coordinate' ;
36
- import { targetWithCenterIcon } from './icons' ;
36
+ import { pencilSolidIcon , targetWithCenterIcon } from './icons' ;
37
37
38
38
interface ICreateEntry {
39
39
tracker : JupyterGISTracker ;
@@ -878,6 +878,32 @@ export function addCommands(
878
878
icon : targetWithCenterIcon
879
879
} ) ;
880
880
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
+
881
907
loadKeybindings ( commands , keybindings ) ;
882
908
}
883
909
0 commit comments