11import { SimpleEvent } from '../core' ;
2- import { DefinitionModifier } from '../definition -modifier' ;
2+ import { StateModifier } from '../modifier/state -modifier' ;
33import { DesignerState } from '../designer-state' ;
44import { HistoryController } from '../history-controller' ;
55import { ViewportApi } from './viewport-api' ;
@@ -8,10 +8,10 @@ export class ControlBarApi {
88 public static create (
99 state : DesignerState ,
1010 historyController : HistoryController | undefined ,
11- definitionModifier : DefinitionModifier ,
11+ stateModifier : StateModifier ,
1212 viewportApi : ViewportApi
1313 ) : ControlBarApi {
14- const api = new ControlBarApi ( state , historyController , definitionModifier , viewportApi ) ;
14+ const api = new ControlBarApi ( state , historyController , stateModifier , viewportApi ) ;
1515 state . onIsReadonlyChanged . subscribe ( api . onStateChanged . forward ) ;
1616 state . onSelectedStepIdChanged . subscribe ( api . onStateChanged . forward ) ;
1717 state . onIsDragDisabledChanged . subscribe ( api . onStateChanged . forward ) ;
@@ -24,19 +24,12 @@ export class ControlBarApi {
2424 private constructor (
2525 private readonly state : DesignerState ,
2626 private readonly historyController : HistoryController | undefined ,
27- private readonly definitionModifier : DefinitionModifier ,
27+ private readonly stateModifier : StateModifier ,
2828 private readonly viewportApi : ViewportApi
2929 ) { }
3030
3131 public readonly onStateChanged = new SimpleEvent < unknown > ( ) ;
3232
33- /**
34- * @deprecated Don't use this method
35- */
36- public subscribe ( handler : ( ) => void ) {
37- this . onStateChanged . subscribe ( handler ) ;
38- }
39-
4033 public resetViewport ( ) {
4134 this . viewportApi . resetViewport ( ) ;
4235 }
@@ -87,7 +80,7 @@ export class ControlBarApi {
8780
8881 public tryDelete ( ) : boolean {
8982 if ( this . canDelete ( ) && this . state . selectedStepId ) {
90- this . definitionModifier . tryDelete ( this . state . selectedStepId ) ;
83+ this . stateModifier . tryDelete ( this . state . selectedStepId ) ;
9184 return true ;
9285 }
9386 return false ;
@@ -98,7 +91,7 @@ export class ControlBarApi {
9891 ! ! this . state . selectedStepId &&
9992 ! this . state . isReadonly &&
10093 ! this . state . isDragging &&
101- this . definitionModifier . isDeletable ( this . state . selectedStepId )
94+ this . stateModifier . isDeletable ( this . state . selectedStepId )
10295 ) ;
10396 }
10497}
0 commit comments