1
1
import { SimpleEvent } from '../core' ;
2
- import { DefinitionModifier } from '../definition -modifier' ;
2
+ import { StateModifier } from '../modifier/state -modifier' ;
3
3
import { DesignerState } from '../designer-state' ;
4
4
import { HistoryController } from '../history-controller' ;
5
5
import { ViewportApi } from './viewport-api' ;
@@ -8,10 +8,10 @@ export class ControlBarApi {
8
8
public static create (
9
9
state : DesignerState ,
10
10
historyController : HistoryController | undefined ,
11
- definitionModifier : DefinitionModifier ,
11
+ stateModifier : StateModifier ,
12
12
viewportApi : ViewportApi
13
13
) : ControlBarApi {
14
- const api = new ControlBarApi ( state , historyController , definitionModifier , viewportApi ) ;
14
+ const api = new ControlBarApi ( state , historyController , stateModifier , viewportApi ) ;
15
15
state . onIsReadonlyChanged . subscribe ( api . onStateChanged . forward ) ;
16
16
state . onSelectedStepIdChanged . subscribe ( api . onStateChanged . forward ) ;
17
17
state . onIsDragDisabledChanged . subscribe ( api . onStateChanged . forward ) ;
@@ -24,19 +24,12 @@ export class ControlBarApi {
24
24
private constructor (
25
25
private readonly state : DesignerState ,
26
26
private readonly historyController : HistoryController | undefined ,
27
- private readonly definitionModifier : DefinitionModifier ,
27
+ private readonly stateModifier : StateModifier ,
28
28
private readonly viewportApi : ViewportApi
29
29
) { }
30
30
31
31
public readonly onStateChanged = new SimpleEvent < unknown > ( ) ;
32
32
33
- /**
34
- * @deprecated Don't use this method
35
- */
36
- public subscribe ( handler : ( ) => void ) {
37
- this . onStateChanged . subscribe ( handler ) ;
38
- }
39
-
40
33
public resetViewport ( ) {
41
34
this . viewportApi . resetViewport ( ) ;
42
35
}
@@ -87,7 +80,7 @@ export class ControlBarApi {
87
80
88
81
public tryDelete ( ) : boolean {
89
82
if ( this . canDelete ( ) && this . state . selectedStepId ) {
90
- this . definitionModifier . tryDelete ( this . state . selectedStepId ) ;
83
+ this . stateModifier . tryDelete ( this . state . selectedStepId ) ;
91
84
return true ;
92
85
}
93
86
return false ;
@@ -98,7 +91,7 @@ export class ControlBarApi {
98
91
! ! this . state . selectedStepId &&
99
92
! this . state . isReadonly &&
100
93
! this . state . isDragging &&
101
- this . definitionModifier . isDeletable ( this . state . selectedStepId )
94
+ this . stateModifier . isDeletable ( this . state . selectedStepId )
102
95
) ;
103
96
}
104
97
}
0 commit comments