@@ -4,7 +4,7 @@ import * as Notification from '../utils/Notification';
4
4
import NeonView from '../NeonView' ;
5
5
import { SplitStaffHandler } from './StaffTools' ;
6
6
import { SplitNeumeHandler } from './NeumeTools' ;
7
- import { EditorAction } from '../Types' ;
7
+ import { ChainAction , ChangeStaffAction , EditorAction , MergeAction , RemoveAction , SetAction , SetClefAction } from '../Types' ;
8
8
import { getStaffBBox } from '../utils/SelectTools' ;
9
9
10
10
/**
@@ -24,7 +24,7 @@ export function initNeonView (view: NeonView): void {
24
24
* @param id - The id of the neume component.
25
25
* @returns An action that unsets the inclinatum parameter of a neume component.
26
26
*/
27
- export function unsetInclinatumAction ( id : string ) : EditorAction {
27
+ export function unsetInclinatumAction ( id : string ) : SetAction {
28
28
return {
29
29
action : 'set' ,
30
30
param : {
@@ -39,7 +39,7 @@ export function unsetInclinatumAction (id: string): EditorAction {
39
39
* @param id - The id of the neume component.
40
40
* @returns An action that unsets the virga parameter of a neume component.
41
41
*/
42
- export function unsetVirgaAction ( id : string ) : EditorAction {
42
+ export function unsetVirgaAction ( id : string ) : SetAction {
43
43
return {
44
44
action : 'set' ,
45
45
param : {
@@ -54,7 +54,7 @@ export function unsetVirgaAction (id: string): EditorAction {
54
54
* @param id - The id of the neume component.
55
55
* @returns An action that unsets the reversed virga parameter of a neume component.
56
56
*/
57
- export function unsetVirgaReversedAction ( id : string ) : EditorAction {
57
+ export function unsetVirgaReversedAction ( id : string ) : SetAction {
58
58
return {
59
59
action : 'set' ,
60
60
param : {
@@ -69,7 +69,7 @@ export function unsetVirgaReversedAction (id: string): EditorAction {
69
69
* @param id - The id of the neume component.
70
70
* @returns An action that unsets the liquescent_clockwise parameter of a neume component.
71
71
*/
72
- export function unsetLiquescentClockwiseAction ( id : string ) : EditorAction {
72
+ export function unsetLiquescentClockwiseAction ( id : string ) : SetAction {
73
73
return {
74
74
action : 'set' ,
75
75
param : {
@@ -84,7 +84,7 @@ export function unsetLiquescentClockwiseAction (id: string): EditorAction {
84
84
* @param id - The id of the neume component.
85
85
* @returns An action that unsets the liquescent_anticlockwise parameter of a neume component.
86
86
*/
87
- export function unsetLiquescentAnticlockwiseAction ( id : string ) : EditorAction {
87
+ export function unsetLiquescentAnticlockwiseAction ( id : string ) : SetAction {
88
88
return {
89
89
action : 'set' ,
90
90
param : {
@@ -117,7 +117,7 @@ export function endOptionsSelection (): void {
117
117
* Function to handle removing elements
118
118
*/
119
119
export function removeHandler ( ) : void {
120
- const toRemove = [ ] ;
120
+ const toRemove : RemoveAction [ ] = [ ] ;
121
121
const selected = Array . from ( document . getElementsByClassName ( 'selected' ) ) ;
122
122
selected . forEach ( elem => {
123
123
if ( elem . classList . contains ( 'syl' ) ) {
@@ -138,7 +138,7 @@ export function removeHandler (): void {
138
138
}
139
139
) ;
140
140
} ) ;
141
- const chainAction : EditorAction = {
141
+ const chainAction : ChainAction = {
142
142
action : 'chain' ,
143
143
param : toRemove
144
144
} ;
@@ -150,7 +150,7 @@ export function removeHandler (): void {
150
150
* Function to handle re-associating elements to the nearest staff
151
151
*/
152
152
export function changeStaffHandler ( ) : void {
153
- const toChange : EditorAction [ ] = [ ] ;
153
+ const toChange : ChangeStaffAction [ ] = [ ] ;
154
154
const selected = Array . from ( document . getElementsByClassName ( 'selected' ) ) ;
155
155
selected . forEach ( elem => {
156
156
toChange . push (
@@ -187,7 +187,7 @@ export function insertToSyllableHandler(): void {
187
187
}
188
188
) ;
189
189
} ) ;
190
- const chainAction : EditorAction = {
190
+ const chainAction : ChainAction = {
191
191
action : 'chain' ,
192
192
param : toInsert
193
193
} ;
@@ -260,7 +260,7 @@ export function triggerNcActions (nc: SVGGraphicsElement): void {
260
260
const unsetVirgaReversed = unsetVirgaReversedAction ( nc . id ) ;
261
261
const unsetLiquescentClockwise = unsetLiquescentClockwiseAction ( nc . id ) ;
262
262
const unsetLiquescentAnticlockwise = unsetLiquescentAnticlockwiseAction ( nc . id ) ;
263
- const setInclinatum = {
263
+ const setInclinatum : SetAction = {
264
264
action : 'set' ,
265
265
param : {
266
266
elementId : nc . id ,
@@ -285,7 +285,7 @@ export function triggerNcActions (nc: SVGGraphicsElement): void {
285
285
const unsetInclinatum = unsetInclinatumAction ( nc . id ) ;
286
286
const unsetLiquescentClockwise = unsetLiquescentClockwiseAction ( nc . id ) ;
287
287
const unsetLiquescentAnticlockwise = unsetLiquescentAnticlockwiseAction ( nc . id ) ;
288
- const setVirga = {
288
+ const setVirga : SetAction = {
289
289
action : 'set' ,
290
290
param : {
291
291
elementId : nc . id ,
@@ -310,7 +310,7 @@ export function triggerNcActions (nc: SVGGraphicsElement): void {
310
310
const unsetVirga = unsetVirgaAction ( nc . id ) ;
311
311
const unsetLiquescentClockwise = unsetLiquescentClockwiseAction ( nc . id ) ;
312
312
const unsetLiquescentAnticlockwise = unsetLiquescentAnticlockwiseAction ( nc . id ) ;
313
- const setVirgaReversed = {
313
+ const setVirgaReversed : SetAction = {
314
314
action : 'set' ,
315
315
param : {
316
316
elementId : nc . id ,
@@ -335,7 +335,7 @@ export function triggerNcActions (nc: SVGGraphicsElement): void {
335
335
const unsetVirga = unsetVirgaAction ( nc . id ) ;
336
336
const unsetVirgaReversed = unsetVirgaReversedAction ( nc . id ) ;
337
337
const unsetLiquescentAnticlockwise = unsetLiquescentAnticlockwiseAction ( nc . id ) ;
338
- const setLiquescentClockwise = {
338
+ const setLiquescentClockwise : SetAction = {
339
339
action : 'set' ,
340
340
param : {
341
341
elementId : nc . id ,
@@ -360,7 +360,7 @@ export function triggerNcActions (nc: SVGGraphicsElement): void {
360
360
const unsetVirga = unsetVirgaAction ( nc . id ) ;
361
361
const unsetVirgaReversed = unsetVirgaReversedAction ( nc . id ) ;
362
362
const unsetLiquescentClockwise = unsetLiquescentClockwiseAction ( nc . id ) ;
363
- const setLiquescentAnticlockwise = {
363
+ const setLiquescentAnticlockwise : SetAction = {
364
364
action : 'set' ,
365
365
param : {
366
366
elementId : nc . id ,
@@ -575,7 +575,7 @@ export function triggerClefActions (clef: SVGGraphicsElement): void {
575
575
576
576
document . querySelector ( '#CClef.dropdown-item' )
577
577
. addEventListener ( 'click' , ( ) => {
578
- const setCClef : EditorAction = {
578
+ const setCClef : SetClefAction = {
579
579
action : 'setClef' ,
580
580
param : {
581
581
elementId : clef . id ,
@@ -594,7 +594,7 @@ export function triggerClefActions (clef: SVGGraphicsElement): void {
594
594
} ) ;
595
595
document . querySelector ( '#FClef.dropdown-item' )
596
596
. addEventListener ( 'click' , ( ) => {
597
- const setFClef : EditorAction = {
597
+ const setFClef : SetClefAction = {
598
598
action : 'setClef' ,
599
599
param : {
600
600
elementId : clef . id ,
@@ -677,7 +677,7 @@ export function triggerAccidActions (accid: SVGGraphicsElement): void {
677
677
678
678
document . querySelector ( '#ChangeToFlat.dropdown-item' )
679
679
. addEventListener ( 'click' , ( ) => {
680
- const changeToFlat : EditorAction = {
680
+ const changeToFlat : SetAction = {
681
681
action : 'set' ,
682
682
param : {
683
683
elementId : accid . id ,
0 commit comments