@@ -7,7 +7,6 @@ import { ConfigService } from '../../../services/configService';
77import { NodeService } from '../../../services/nodeService' ;
88import { ProjectAssetService } from '../../../../site/src/app/services/projectAssetService' ;
99import { TeacherProjectService } from '../../../services/teacherProjectService' ;
10- import { UtilService } from '../../../services/utilService' ;
1110import { Subject , Subscription } from 'rxjs' ;
1211import { debounceTime , distinctUntilChanged } from 'rxjs/operators' ;
1312
@@ -17,6 +16,23 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
1716 styleUrls : [ 'draw-authoring.component.scss' ]
1817} )
1918export class DrawAuthoring extends ComponentAuthoring {
19+ allToolNames : string [ ] = [
20+ 'select' ,
21+ 'line' ,
22+ 'shape' ,
23+ 'freeHand' ,
24+ 'text' ,
25+ 'stamp' ,
26+ 'strokeColor' ,
27+ 'fillColor' ,
28+ 'clone' ,
29+ 'strokeWidth' ,
30+ 'sendBack' ,
31+ 'sendForward' ,
32+ 'undo' ,
33+ 'redo' ,
34+ 'delete'
35+ ] ;
2036 width : number ;
2137 height : number ;
2238 defaultWidth : number = 800 ;
@@ -39,8 +55,7 @@ export class DrawAuthoring extends ComponentAuthoring {
3955 protected ConfigService : ConfigService ,
4056 protected NodeService : NodeService ,
4157 protected ProjectAssetService : ProjectAssetService ,
42- protected ProjectService : TeacherProjectService ,
43- protected UtilService : UtilService
58+ protected ProjectService : TeacherProjectService
4459 ) {
4560 super ( ConfigService , NodeService , ProjectAssetService , ProjectService ) ;
4661 this . inputChangeSubscription = this . inputChange
@@ -85,47 +100,13 @@ export class DrawAuthoring extends ComponentAuthoring {
85100 this . stampImageChangeSubscription . unsubscribe ( ) ;
86101 }
87102
88- enableAllToolsButtonClicked ( ) : void {
103+ enableAllTools ( doEnable : boolean ) {
89104 if ( this . authoringComponentContent . tools == null ) {
90105 this . authoringComponentContent . tools = { } ;
91106 }
92- this . authoringComponentContent . tools . select = true ;
93- this . authoringComponentContent . tools . line = true ;
94- this . authoringComponentContent . tools . shape = true ;
95- this . authoringComponentContent . tools . freeHand = true ;
96- this . authoringComponentContent . tools . text = true ;
97- this . authoringComponentContent . tools . stamp = true ;
98- this . authoringComponentContent . tools . strokeColor = true ;
99- this . authoringComponentContent . tools . fillColor = true ;
100- this . authoringComponentContent . tools . clone = true ;
101- this . authoringComponentContent . tools . strokeWidth = true ;
102- this . authoringComponentContent . tools . sendBack = true ;
103- this . authoringComponentContent . tools . sendForward = true ;
104- this . authoringComponentContent . tools . undo = true ;
105- this . authoringComponentContent . tools . redo = true ;
106- this . authoringComponentContent . tools . delete = true ;
107- this . componentChanged ( ) ;
108- }
109-
110- disableAllToolsButtonClicked ( ) : void {
111- if ( this . authoringComponentContent . tools == null ) {
112- this . authoringComponentContent . tools = { } ;
113- }
114- this . authoringComponentContent . tools . select = false ;
115- this . authoringComponentContent . tools . line = false ;
116- this . authoringComponentContent . tools . shape = false ;
117- this . authoringComponentContent . tools . freeHand = false ;
118- this . authoringComponentContent . tools . text = false ;
119- this . authoringComponentContent . tools . stamp = false ;
120- this . authoringComponentContent . tools . strokeColor = false ;
121- this . authoringComponentContent . tools . fillColor = false ;
122- this . authoringComponentContent . tools . clone = false ;
123- this . authoringComponentContent . tools . strokeWidth = false ;
124- this . authoringComponentContent . tools . sendBack = false ;
125- this . authoringComponentContent . tools . sendForward = false ;
126- this . authoringComponentContent . tools . undo = false ;
127- this . authoringComponentContent . tools . redo = false ;
128- this . authoringComponentContent . tools . delete = false ;
107+ this . allToolNames . map ( ( toolName ) => {
108+ this . authoringComponentContent . tools [ toolName ] = doEnable ;
109+ } ) ;
129110 this . componentChanged ( ) ;
130111 }
131112
0 commit comments