vibe-editor 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +66 -61
- package/src/scripts/js/Core.js +28 -9
- package/src/scripts/js/entry.js +6 -5
- package/src/scripts/js/gui/Annotations.js +27 -12
- package/src/scripts/js/gui/ScoreManipulator.js +6 -4
- package/src/scripts/js/gui/Tabbar.js +13 -4
- package/src/scripts/js/handlers/AnnotationChangeHandler.js +13 -1
- package/src/scripts/js/handlers/InsertModeHandler.js +3 -3
- package/src/scripts/js/handlers/PhantomElementHandler.js +3 -10
- package/src/scripts/js/handlers/WindowHandler.js +7 -7
- package/src/scripts/js/scripts/Core.js +932 -0
- package/src/scripts/js/scripts/MusicProcessor.js +810 -0
- package/src/scripts/js/scripts/VIBE.js +219 -0
- package/src/scripts/js/scripts/datastructures/MeasureMatrix.js +156 -0
- package/src/scripts/js/scripts/gui/Annotations.js +549 -0
- package/src/scripts/js/scripts/gui/Cursor.js +203 -0
- package/src/scripts/js/scripts/gui/PhantomElement.js +132 -0
- package/src/scripts/js/scripts/gui/ScoreManipulator.js +188 -0
- package/src/scripts/js/scripts/gui/Tabbar.js +705 -0
- package/src/scripts/js/{gui/Toolbar copy.js → scripts/gui/Toolbar.js} +15 -11
- package/src/scripts/js/scripts/handlers/AnnotationChangeHandler.js +650 -0
- package/src/scripts/js/scripts/handlers/ClickModeHandler.js +535 -0
- package/src/scripts/js/{gui → scripts/handlers}/CustomAnnotationShapeDrawer.js +34 -17
- package/src/scripts/js/{handlers/ModHandler.js → scripts/handlers/CustomToolbarHandler.js} +54 -66
- package/src/scripts/js/scripts/handlers/GlobalKeyboardHandler.js +372 -0
- package/src/scripts/js/scripts/handlers/Handler.js +2 -0
- package/src/scripts/js/{handlers/InsertModeHandler_deprecated.js → scripts/handlers/InsertModeHandler.js} +117 -164
- package/src/scripts/js/scripts/handlers/KeyModeHandler.js +405 -0
- package/src/scripts/js/scripts/handlers/LabelHandler.js +463 -0
- package/src/scripts/js/scripts/handlers/NoteDragHandler.js +97 -0
- package/src/scripts/js/scripts/handlers/PhantomElementHandler.js +161 -0
- package/src/scripts/js/scripts/handlers/ScoreManipulatorHandler.js +233 -0
- package/src/scripts/js/scripts/handlers/SidebarHandler.js +506 -0
- package/src/scripts/js/scripts/handlers/TooltipHandler.js +132 -0
- package/src/scripts/js/scripts/handlers/WindowHandler.js +278 -0
- package/src/scripts/js/scripts/utils/MEIOperations.js +2121 -0
- package/src/scripts/js/{utils/Mouse2MEI.js → scripts/utils/Mouse2SVG.js} +225 -57
- package/src/scripts/js/scripts/utils/SVGEditor.js +453 -0
- package/src/scripts/js/scripts/utils/Types.js +2 -0
- package/src/scripts/js/{utils/VerovioWrapper copy.js → scripts/utils/VerovioWrapper.js} +32 -18
- package/src/scripts/js/scripts/utils/coordinates.js +78 -0
- package/src/scripts/js/utils/Mouse2SVG.js +11 -4
- package/src/scripts/js/utils/VerovioWrapper.js +4 -4
- package/src/scripts/js/utils/coordinates.js +26 -2
- package/src/styles/vibe.css +32 -6
- package/src/scripts/js/.DS_Store +0 -0
- package/src/scripts/js/MusicPlayer.js +0 -572
- package/src/scripts/js/datastructures/ScoreGraph copy.js +0 -432
- package/src/scripts/js/gui/CustomAnnotationDrawer.js +0 -114
- package/src/scripts/js/handlers/AnnotationDragHandler.js +0 -113
- package/src/scripts/js/handlers/AnnotationLineHandler.js +0 -113
- package/src/scripts/js/handlers/ArticulationHandler.js +0 -20
- package/src/scripts/js/handlers/HarmonyHandler.js +0 -282
- package/src/scripts/js/handlers/InsertModeHandler copy.js +0 -423
- package/src/scripts/js/handlers/KeyModeHandler copy.js +0 -407
- package/src/scripts/js/handlers/KeyModeHandler_deprecated.js +0 -411
- package/src/scripts/js/handlers/NoteDragHandler copy.js +0 -148
- package/src/scripts/js/handlers/NoteDragHandler_deprecated.js +0 -150
- package/src/scripts/js/handlers/SelectionHandler.js +0 -262
- package/src/scripts/js/utils/RectWrapper.js +0 -10
- package/src/scripts/js/utils/SVGFiller.js +0 -245
- package/src/scripts/js/utils/VerovioWrapperLocal.js +0 -156
- package/src/scripts/js/utils/firefoxBBoxes.js +0 -143
- /package/src/scripts/js/{assets → scripts/assets}/mei_template.js +0 -0
- /package/src/scripts/js/{constants.js → scripts/constants.js} +0 -0
- /package/src/scripts/js/{datastructures → scripts/datastructures}/ScoreGraph.js +0 -0
- /package/src/scripts/js/{datastructures → scripts/datastructures}/ScoreGraph_deprecated.js +0 -0
- /package/src/scripts/js/{datastructures → scripts/datastructures}/ScoreNode.js +0 -0
- /package/src/scripts/js/{gui → scripts/gui}/HarmonyLabel.js +0 -0
- /package/src/scripts/js/{gui → scripts/gui}/Label.js +0 -0
- /package/src/scripts/js/{gui → scripts/gui}/TempoLabel.js +0 -0
- /package/src/scripts/js/{handlers → scripts/handlers}/DeleteHandler.js +0 -0
- /package/src/scripts/js/{utils → scripts/utils}/DOMCreator.js +0 -0
- /package/src/scripts/js/{utils → scripts/utils}/MEIConverter.js +0 -0
- /package/src/scripts/js/{utils → scripts/utils}/ReactWrapper.js +0 -0
- /package/src/scripts/js/{utils → scripts/utils}/convenienceQueries.js +0 -0
- /package/src/scripts/js/{utils → scripts/utils}/mappings.js +0 -0
- /package/src/scripts/js/{utils → scripts/utils}/random.js +0 -0
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.default = void 0;
|
4
|
-
const SelectionHandler_1 = require("./SelectionHandler");
|
5
4
|
const Annotations_1 = require("../gui/Annotations");
|
6
5
|
const LabelHandler_1 = require("./LabelHandler");
|
7
6
|
const KeyModeHandler_1 = require("./KeyModeHandler");
|
@@ -12,8 +11,9 @@ const ScoreManipulatorHandler_1 = require("./ScoreManipulatorHandler");
|
|
12
11
|
const MEIOperations_1 = require("../utils/MEIOperations");
|
13
12
|
const cq = require("../utils/convenienceQueries");
|
14
13
|
/**
|
15
|
-
*
|
16
|
-
*
|
14
|
+
* Handle logic and interaction with Tabbar and Custom Toolbar.
|
15
|
+
* Activates and deactivates interface behavior according to selected tabbar or or custom group button.
|
16
|
+
* E.g. Selection is deactivated during harmonylabels are active, or Notations with keyboard and mouse are deactivated when annotations are active.
|
17
17
|
*/
|
18
18
|
class InsertModeHandler {
|
19
19
|
constructor(containerId) {
|
@@ -21,132 +21,89 @@ class InsertModeHandler {
|
|
21
21
|
this.activateHarmonyModeFunction = (function activateHarmonyModeFunction(clicked = false) {
|
22
22
|
this.activateHarmonyMode(clicked);
|
23
23
|
}).bind(this);
|
24
|
+
this.firstCall = true;
|
24
25
|
this.isGlobal = true;
|
25
26
|
this.annotations = new Annotations_1.default(containerId);
|
26
27
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
28
|
+
activateInsertMode(clicked = false) {
|
29
|
+
var _a;
|
30
|
+
// if (this.annotationMode || this.harmonyMode) {
|
31
|
+
// this.insertDeactivate()
|
32
|
+
// }
|
33
|
+
// if (clicked) {
|
34
|
+
// if (this.unselectMenuItem("clickInsert")) { return }
|
35
|
+
// }
|
36
36
|
this.container.classList.add("clickmode");
|
37
|
-
this.
|
37
|
+
this.container.classList.add("textmode");
|
38
|
+
this.keyMode = true;
|
38
39
|
this.clickInsertMode = true;
|
39
40
|
this.annotationMode = false;
|
40
41
|
this.harmonyMode = false;
|
41
42
|
this.phantomNoteHandler = new PhantomElementHandler_1.default(this.containerId);
|
42
43
|
this.setPhantomNote();
|
43
|
-
this.clickModeHandler = this.clickModeHandler
|
44
|
+
this.clickModeHandler = this.clickModeHandler || new ClickModeHandler_1.default();
|
44
45
|
this.clickModeHandler
|
45
46
|
.setContainerId(this.containerId)
|
47
|
+
.setScoreGraph(this.scoreGraph)
|
46
48
|
.setInsertCallback(this.insertCallback)
|
47
49
|
.setDeleteCallback(this.deleteCallback)
|
48
50
|
.setAnnotations(this.annotations)
|
49
|
-
.
|
50
|
-
.
|
51
|
+
.setm2s(this.m2s)
|
52
|
+
.setMusicProcessor(this.musicPlayer)
|
51
53
|
.setPhantomCursor(this.phantomNoteHandler)
|
52
54
|
.resetListeners();
|
53
|
-
// if(typeof this.selectionHandler !== "undefined"){
|
54
|
-
// this.selectionHandler.removeListeners()
|
55
|
-
// }
|
56
|
-
this.deleteHandler.setListeners();
|
57
|
-
}
|
58
|
-
activateKeyMode(clicked = false) {
|
59
|
-
var _a;
|
60
|
-
if (this.clickInsertMode || this.annotationMode || this.harmonyMode) {
|
61
|
-
this.insertDeactivate();
|
62
|
-
}
|
63
|
-
if (clicked) {
|
64
|
-
if (this.unselectMenuItem("keyMode")) {
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
}
|
68
|
-
this.container.classList.add("textmode");
|
69
|
-
this.keyMode = true;
|
70
|
-
this.clickInsertMode = false;
|
71
|
-
this.annotationMode = false;
|
72
|
-
this.harmonyMode = false;
|
73
|
-
var cursor = null;
|
74
|
-
if (this.keyModeHandler != undefined) {
|
75
|
-
//cursor = this.keyModeHandler.cursor
|
76
|
-
}
|
77
55
|
this.keyModeHandler = this.keyModeHandler || new KeyModeHandler_1.default(this.containerId);
|
78
|
-
var currNodeId;
|
79
|
-
if (((_a = this.keyModeHandler.scoreGraph) === null || _a === void 0 ? void 0 : _a.getCurrentNode()) != undefined) {
|
80
|
-
currNodeId = this.keyModeHandler.scoreGraph.getCurrentNode().getId();
|
81
|
-
}
|
82
56
|
this.keyModeHandler
|
83
57
|
.setContainerId(this.containerId)
|
84
58
|
.setInsertCallback(this.insertCallback)
|
85
59
|
.setDeleteCallback(this.deleteCallback)
|
86
60
|
.setScoreGraph(this.scoreGraph)
|
87
|
-
.
|
88
|
-
.
|
61
|
+
.setm2s(this.m2s)
|
62
|
+
.setMusicProcessor(this.musicPlayer)
|
89
63
|
.resetListeners();
|
90
|
-
if (currNodeId != undefined) {
|
91
|
-
this.keyModeHandler.setCurrentNodeScoreGraph(currNodeId);
|
92
|
-
}
|
93
|
-
// if(typeof this.selectionHandler !== "undefined"){
|
94
|
-
// this.selectionHandler.removeListeners()
|
95
|
-
// }
|
96
64
|
this.deleteHandler.setListeners();
|
65
|
+
(_a = this.annotations) === null || _a === void 0 ? void 0 : _a.setm2s(this.m2s);
|
66
|
+
//this.annotations?.updateCanvas()
|
67
|
+
//this.annotations?.resetTextListeners() // annotations should also be interactable when in notation mode
|
68
|
+
//this.activateSelectionMode()
|
97
69
|
}
|
98
|
-
|
99
|
-
|
100
|
-
this.selectionHandler = new SelectionHandler_1.default(this.containerId);
|
101
|
-
this.selectionHandler.setM2M(this.m2m);
|
102
|
-
//this.selectionHandler.setHarmonyHandler(this.harmonyHandler)
|
103
|
-
//this.deleteHandler.setListeners()
|
104
|
-
return this;
|
105
|
-
}
|
106
|
-
activateAnnotationMode(clicked = false) {
|
70
|
+
activateAnnotationMode() {
|
71
|
+
var _a;
|
107
72
|
this.insertDeactivate();
|
108
|
-
|
109
|
-
if (this.unselectMenuItem("activateAnnot")) {
|
110
|
-
return;
|
111
|
-
}
|
112
|
-
}
|
113
|
-
if (this.annotations == undefined) {
|
114
|
-
this.annotations = new Annotations_1.default(this.containerId);
|
115
|
-
}
|
116
|
-
else {
|
117
|
-
this.annotations.update();
|
118
|
-
}
|
119
|
-
this.annotations
|
120
|
-
.setContainerId(this.containerId)
|
121
|
-
.setM2M(this.m2m)
|
122
|
-
.setMusicPlayer(this.musicPlayer)
|
123
|
-
.setToFront()
|
124
|
-
.setMenuClickHandler();
|
73
|
+
var that = this;
|
125
74
|
this.keyMode = false;
|
126
75
|
this.clickInsertMode = false;
|
127
|
-
this.
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
76
|
+
var selectedButton = (_a = this.container.querySelector("#annotGroupKM button.selected")) === null || _a === void 0 ? void 0 : _a.id;
|
77
|
+
switch (selectedButton) {
|
78
|
+
case "harmonyAnnotButton":
|
79
|
+
this.activateHarmonyMode();
|
80
|
+
this.harmonyMode = true;
|
81
|
+
this.annotationMode = false;
|
82
|
+
break;
|
83
|
+
case "staticTextButton":
|
84
|
+
case "linkedAnnotButton":
|
85
|
+
this.container.classList.remove("harmonyMode");
|
86
|
+
this.annotationMode = true;
|
87
|
+
this.harmonyMode = false;
|
88
|
+
if (this.annotations == undefined) {
|
89
|
+
this.annotations = new Annotations_1.default(this.containerId);
|
135
90
|
}
|
136
|
-
|
137
|
-
|
138
|
-
catch (_a) {
|
139
|
-
try {
|
140
|
-
var harmonyButton = this.container.querySelector("#harmonyAnnotButton");
|
141
|
-
if (!harmonyButton.classList.contains("selected")) {
|
142
|
-
harmonyButton.classList.add("selected");
|
91
|
+
else {
|
92
|
+
this.annotations.updateCanvas();
|
143
93
|
}
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
return;
|
148
|
-
}
|
94
|
+
this.annotations.setAnnotationCanvas(cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
95
|
+
this.annotations.updateLinkedTexts();
|
96
|
+
break;
|
149
97
|
}
|
98
|
+
this.annotations
|
99
|
+
.setContainerId(this.containerId)
|
100
|
+
.setm2s(this.m2s)
|
101
|
+
.setMusicProcessor(this.musicPlayer)
|
102
|
+
//.setToFront()
|
103
|
+
.setListeners()
|
104
|
+
.setMenuClickHandler();
|
105
|
+
}
|
106
|
+
activateHarmonyMode() {
|
150
107
|
if (this.labelHandler == undefined) {
|
151
108
|
this.labelHandler = new LabelHandler_1.default(this.containerId);
|
152
109
|
}
|
@@ -163,9 +120,9 @@ class InsertModeHandler {
|
|
163
120
|
.setContainerId(this.containerId)
|
164
121
|
.setGlobal(this.isGlobal)
|
165
122
|
.setListeners()
|
166
|
-
.
|
167
|
-
.
|
168
|
-
.setCurrentMEI(this.
|
123
|
+
.setm2s(this.m2s)
|
124
|
+
.setMusicProcessor(this.musicPlayer)
|
125
|
+
.setCurrentMEI(this.m2s.getCurrentMei())
|
169
126
|
.setLoadDataCallback(this.loadDataCallback);
|
170
127
|
//this.keyMode = false;
|
171
128
|
//this.clickInsertMode = false;
|
@@ -197,7 +154,7 @@ class InsertModeHandler {
|
|
197
154
|
// this.selectionHandler = undefined
|
198
155
|
if (this.annotations != undefined) {
|
199
156
|
this.annotations.removeListeners();
|
200
|
-
this.annotations.setToBack()
|
157
|
+
//this.annotations.setToBack()
|
201
158
|
this.annotationMode = false;
|
202
159
|
}
|
203
160
|
if (this.labelHandler != undefined) {
|
@@ -208,38 +165,44 @@ class InsertModeHandler {
|
|
208
165
|
if (this.deleteHandler != undefined) {
|
209
166
|
this.deleteHandler.removeListeners();
|
210
167
|
}
|
211
|
-
//selectionnmode should be always active.
|
212
|
-
//Listeners will overwritten if another mode listen same behaviour on same element (d3.js), e.g. annotation
|
213
|
-
this.activateSelectionMode();
|
214
168
|
}
|
215
169
|
setSMHandler() {
|
216
170
|
if (this.smHandler == undefined) {
|
217
171
|
this.smHandler = new ScoreManipulatorHandler_1.default();
|
218
172
|
}
|
173
|
+
//var activeLayer = this.container.querySelector(".activeLayer")
|
219
174
|
this.smHandler
|
220
175
|
.setContainerId(this.containerId)
|
221
|
-
.
|
222
|
-
.
|
176
|
+
.setm2s(this.m2s)
|
177
|
+
.setMEI(this.m2s.getCurrentMei())
|
178
|
+
.setScoreGraph(this.scoreGraph)
|
179
|
+
.setMusicProcessor(this.musicPlayer)
|
223
180
|
.setLoadDataCallback(this.loadDataCallback)
|
224
181
|
.drawElements();
|
182
|
+
//create some more measures at start for debugging purposes
|
183
|
+
// if (this.firstCall) {
|
184
|
+
// for (let i = 0; i < 15; i++) {
|
185
|
+
// this.interactionOverlay.querySelector("#measureAdder").dispatchEvent(new MouseEvent("click"))
|
186
|
+
// }
|
187
|
+
// this.firstCall = false
|
188
|
+
// }
|
189
|
+
return this;
|
225
190
|
}
|
226
191
|
setListeners() {
|
227
192
|
var that = this;
|
228
|
-
Array.from(this.container.querySelectorAll(".dropdown-item")).forEach(n => {
|
193
|
+
Array.from(this.container.querySelectorAll(".dropdown-item, .tabBtn")).forEach(n => {
|
229
194
|
n.addEventListener("click", function (e) {
|
230
195
|
e.preventDefault();
|
231
196
|
switch (this.id) {
|
197
|
+
case "notationTabBtn":
|
198
|
+
case "articulationTabBtn":
|
232
199
|
case "clickInsert":
|
233
|
-
that.activateClickMode(true);
|
234
|
-
break;
|
235
200
|
case "keyMode":
|
236
|
-
that.
|
201
|
+
that.activateInsertMode(true);
|
237
202
|
break;
|
203
|
+
case "annotationTabBtn":
|
238
204
|
case "activateAnnot":
|
239
|
-
that.activateAnnotationMode(
|
240
|
-
break;
|
241
|
-
case "activateHarm":
|
242
|
-
that.activateHarmonyMode(true);
|
205
|
+
that.activateAnnotationMode();
|
243
206
|
break;
|
244
207
|
default:
|
245
208
|
that.insertDeactivate();
|
@@ -247,19 +210,20 @@ class InsertModeHandler {
|
|
247
210
|
}
|
248
211
|
});
|
249
212
|
});
|
213
|
+
//events will come from Annotations Class.
|
250
214
|
this.container.addEventListener("annotationButtonClicked", function (e) {
|
251
215
|
var t = e.target;
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
else {
|
256
|
-
that.activateHarmonyMode(false);
|
257
|
-
}
|
216
|
+
t.parentElement.querySelectorAll("button").forEach(b => b.classList.remove("selected"));
|
217
|
+
t.classList.add("selected");
|
218
|
+
that.activateAnnotationMode();
|
258
219
|
}, true);
|
259
220
|
Array.from(this.container.querySelectorAll("#noteGroup > *")).forEach(b => {
|
260
221
|
b.addEventListener("click", function (e) {
|
261
222
|
let dur = 0;
|
262
223
|
switch (this.id) {
|
224
|
+
case "breveNote":
|
225
|
+
dur = 0.5;
|
226
|
+
break;
|
263
227
|
case "fullNote":
|
264
228
|
dur = 1;
|
265
229
|
break;
|
@@ -279,14 +243,15 @@ class InsertModeHandler {
|
|
279
243
|
dur = 32;
|
280
244
|
break;
|
281
245
|
}
|
282
|
-
that.
|
283
|
-
if (that.
|
284
|
-
MEIOperations_1.cleanUp(that.
|
285
|
-
var mei = MEIConverter_1.restoreXmlIdTags(that.
|
246
|
+
that.m2s.setDurationNewNote(dur);
|
247
|
+
if (that.m2s.setMarkedNoteDurations(dur)) {
|
248
|
+
MEIOperations_1.cleanUp(that.m2s.getCurrentMei());
|
249
|
+
var mei = MEIConverter_1.restoreXmlIdTags(that.m2s.getCurrentMei());
|
286
250
|
that.loadDataCallback("", mei, false);
|
287
251
|
}
|
288
252
|
});
|
289
253
|
});
|
254
|
+
//Sets dots according to button in dotGroup. If no Button is selected, the dots will be set to 0.
|
290
255
|
Array.from(this.container.querySelectorAll("#dotGroup > *")).forEach(b => {
|
291
256
|
b.addEventListener("click", function (e) {
|
292
257
|
let dots = 0;
|
@@ -299,10 +264,10 @@ class InsertModeHandler {
|
|
299
264
|
dots = 2;
|
300
265
|
}
|
301
266
|
}
|
302
|
-
that.
|
303
|
-
if (that.
|
304
|
-
MEIOperations_1.cleanUp(that.
|
305
|
-
var mei = MEIConverter_1.restoreXmlIdTags(that.
|
267
|
+
that.m2s.setDotsNewNote(dots);
|
268
|
+
if (that.m2s.setMarkedNoteDots(dots)) {
|
269
|
+
MEIOperations_1.cleanUp(that.m2s.getCurrentMei());
|
270
|
+
var mei = MEIConverter_1.restoreXmlIdTags(that.m2s.getCurrentMei());
|
306
271
|
that.loadDataCallback("", mei, false);
|
307
272
|
}
|
308
273
|
});
|
@@ -317,10 +282,9 @@ class InsertModeHandler {
|
|
317
282
|
//reset
|
318
283
|
if (!this.navBarLoaded)
|
319
284
|
this.setListeners();
|
320
|
-
if
|
321
|
-
|
322
|
-
|
323
|
-
this.activateClickMode();
|
285
|
+
//if(this.keyMode) this.activateKeyMode();
|
286
|
+
if (this.clickInsertMode || this.keyMode)
|
287
|
+
this.activateInsertMode(); //this.activateClickMode();
|
324
288
|
if (this.annotationMode)
|
325
289
|
this.activateAnnotationMode();
|
326
290
|
if (this.harmonyMode)
|
@@ -328,36 +292,14 @@ class InsertModeHandler {
|
|
328
292
|
this.setSMHandler();
|
329
293
|
return this;
|
330
294
|
}
|
331
|
-
unselectMenuItem(key) {
|
332
|
-
var menuitem = this.container.querySelector("#" + key);
|
333
|
-
var modeButton = this.container.querySelector("#insertMode");
|
334
|
-
if (menuitem.classList.contains("selected")) {
|
335
|
-
menuitem.classList.remove("selected");
|
336
|
-
modeButton.innerHTML = " ";
|
337
|
-
modeButton.classList.add("empty");
|
338
|
-
this.insertDeactivate();
|
339
|
-
return true;
|
340
|
-
}
|
341
|
-
else {
|
342
|
-
this.container.querySelectorAll("#insertDropdown > a").forEach(a => {
|
343
|
-
if (a.id !== key) {
|
344
|
-
a.classList.remove("selected");
|
345
|
-
}
|
346
|
-
});
|
347
|
-
menuitem.classList.add("selected");
|
348
|
-
modeButton.textContent = menuitem.textContent;
|
349
|
-
modeButton.classList.remove("empty");
|
350
|
-
return false;
|
351
|
-
}
|
352
|
-
}
|
353
295
|
/////////////// GETTER/ SETTER /////////////////
|
354
|
-
|
355
|
-
this.
|
296
|
+
setm2s(m2s) {
|
297
|
+
this.m2s = m2s;
|
356
298
|
//this.selectionHandler = new SelectionHandler()
|
357
|
-
//this.selectionHandler?.
|
299
|
+
//this.selectionHandler?.setm2s(this.m2s)
|
358
300
|
return this;
|
359
301
|
}
|
360
|
-
|
302
|
+
setMusicProcessor(musicPlayer) {
|
361
303
|
this.musicPlayer = musicPlayer;
|
362
304
|
return this;
|
363
305
|
}
|
@@ -378,7 +320,7 @@ class InsertModeHandler {
|
|
378
320
|
this.phantomNoteHandler
|
379
321
|
.setPhantomNote()
|
380
322
|
.setListeners()
|
381
|
-
.
|
323
|
+
.setm2s(this.m2s);
|
382
324
|
}
|
383
325
|
return this;
|
384
326
|
}
|
@@ -401,14 +343,13 @@ class InsertModeHandler {
|
|
401
343
|
setContainerId(containerId) {
|
402
344
|
this.containerId = containerId;
|
403
345
|
this.interactionOverlay = cq.getInteractOverlay(containerId);
|
404
|
-
this.
|
346
|
+
this.vrvSVG = cq.getVrvSVG(containerId);
|
405
347
|
this.container = document.getElementById(containerId);
|
406
348
|
return this;
|
407
349
|
}
|
408
350
|
resetCanvas() {
|
409
|
-
|
410
|
-
|
411
|
-
}
|
351
|
+
var _a;
|
352
|
+
(_a = this.annotations) === null || _a === void 0 ? void 0 : _a.addCanvas().resetListeners();
|
412
353
|
return this;
|
413
354
|
}
|
414
355
|
getAnnotations() {
|
@@ -420,5 +361,17 @@ class InsertModeHandler {
|
|
420
361
|
getPhantomNoteHandler() {
|
421
362
|
return this.phantomNoteHandler;
|
422
363
|
}
|
364
|
+
disableNoteInput() {
|
365
|
+
var _a, _b;
|
366
|
+
(_a = this.keyModeHandler) === null || _a === void 0 ? void 0 : _a.removeListeners();
|
367
|
+
(_b = this.clickModeHandler) === null || _b === void 0 ? void 0 : _b.removeListeners();
|
368
|
+
}
|
369
|
+
enableNoteInput() {
|
370
|
+
var _a, _b;
|
371
|
+
if (!(this.annotationMode || this.harmonyMode)) {
|
372
|
+
(_a = this.keyModeHandler) === null || _a === void 0 ? void 0 : _a.setListeners();
|
373
|
+
(_b = this.clickModeHandler) === null || _b === void 0 ? void 0 : _b.setListeners();
|
374
|
+
}
|
375
|
+
}
|
423
376
|
}
|
424
377
|
exports.default = InsertModeHandler;
|