vibe-editor 0.0.0 → 0.0.1
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/LICENSE +1 -1
- package/README.md +12 -9
- package/package.json +11 -5
- package/src/scripts/js/Core.js +212 -186
- package/src/scripts/js/MusicProcessor.js +286 -128
- package/src/scripts/js/{VerovioScoreEditor.js → VIBE.js} +62 -28
- package/src/scripts/js/assets/mei_template.js +5 -1
- package/src/scripts/js/datastructures/MeasureMatrix.js +6 -85
- package/src/scripts/js/datastructures/ScoreGraph.js +1 -1
- package/src/scripts/js/entry.js +3 -2
- package/src/scripts/js/gui/Annotations.js +188 -111
- package/src/scripts/js/gui/HarmonyLabel.js +26 -2
- package/src/scripts/js/gui/ScoreManipulator.js +61 -31
- package/src/scripts/js/gui/Tabbar.js +41 -21
- package/src/scripts/js/gui/Toolbar.js +4 -4
- package/src/scripts/js/handlers/AnnotationChangeHandler.js +131 -60
- package/src/scripts/js/handlers/ClickModeHandler.js +406 -143
- package/src/scripts/js/handlers/CustomToolbarHandler.js +26 -24
- package/src/scripts/js/handlers/GlobalKeyboardHandler.js +12 -7
- package/src/scripts/js/handlers/InsertModeHandler.js +26 -32
- package/src/scripts/js/handlers/KeyModeHandler.js +12 -86
- package/src/scripts/js/handlers/LabelHandler.js +3 -2
- package/src/scripts/js/handlers/PhantomElementHandler.js +1 -1
- package/src/scripts/js/handlers/ScoreManipulatorHandler.js +101 -14
- package/src/scripts/js/handlers/SelectionHandler.js +80 -36
- package/src/scripts/js/handlers/SideBarHandler.js +10 -3
- package/src/scripts/js/handlers/WindowHandler.js +25 -4
- package/src/scripts/js/utils/DOMCreator.js +1 -1
- package/src/scripts/js/utils/MEIConverter.js +13 -1
- package/src/scripts/js/utils/MEIOperations.js +180 -187
- package/src/scripts/js/utils/Mouse2SVG.js +200 -43
- package/src/scripts/js/utils/ReactWrapper.js +46 -0
- package/src/scripts/js/utils/RectWrapper.js +10 -0
- package/src/scripts/js/utils/SVGEditor.js +94 -3
- package/src/scripts/js/utils/VerovioWrapper.js +6 -1
- package/src/scripts/js/utils/convenienceQueries.js +2 -0
- package/src/scripts/js/utils/mappings.js +322 -56
- package/src/styles/VerovioScoreEditor.css +0 -694
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const constants_1 = require("../constants");
|
4
4
|
const cq = require("../utils/convenienceQueries");
|
5
|
+
const coordinates_1 = require("../utils/coordinates");
|
5
6
|
const manipFlag = "manipulator";
|
6
7
|
/**
|
7
8
|
* Class for all manipulators (Buttons, Lists, etc) directly visible in the score
|
@@ -64,55 +65,83 @@ class ScoreManipulator {
|
|
64
65
|
newSVG.setAttribute("refId", refId);
|
65
66
|
(_a = this.interactionOverlay.querySelector("#manipulatorCanvas")) === null || _a === void 0 ? void 0 : _a.appendChild(newSVG);
|
66
67
|
}
|
67
|
-
|
68
|
+
drawMeasureManipulators() {
|
68
69
|
this.lastBline = Array.from(this.vrvSVG.querySelectorAll(".barLine")).reverse()[0].querySelector("path");
|
69
|
-
var lastBlineRect = this.lastBline.
|
70
|
-
var
|
71
|
-
var
|
72
|
-
|
73
|
-
var blineRight = lastBlineRect.right - rootBBox.x;
|
70
|
+
var lastBlineRect = coordinates_1.getDOMMatrixCoordinates(this.lastBline, this.vrvSVG);
|
71
|
+
var blineTopAdder = lastBlineRect.top;
|
72
|
+
var blineTopRemover = lastBlineRect.top + lastBlineRect.height / 2;
|
73
|
+
var blineRight = lastBlineRect.right;
|
74
74
|
var containerSize = lastBlineRect.height * 0.4;
|
75
|
-
this.drawButton("measureAdder", null, "+", blineRight,
|
76
|
-
|
77
|
-
drawMeasureRemover() {
|
78
|
-
var _a;
|
79
|
-
this.lastBline = Array.from((_a = document.getElementById(this.containerId)) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".barLine")).reverse()[0].querySelector("path");
|
80
|
-
var lastBlineRect = this.lastBline.getBoundingClientRect();
|
81
|
-
var lastBlineRect = this.lastBline.getBoundingClientRect();
|
82
|
-
var rootBBox = this.vrvSVG.getBoundingClientRect();
|
83
|
-
var blineTop = lastBlineRect.top - rootBBox.y + lastBlineRect.height / 2;
|
84
|
-
var blineRight = lastBlineRect.right - rootBBox.x;
|
85
|
-
var containerSize = lastBlineRect.height * 0.4;
|
86
|
-
this.drawButton("measureRemover", null, "-", blineRight, blineTop, containerSize, this.lastBline.closest("svg").parentElement, "Remove Measure");
|
75
|
+
this.drawButton("measureAdder", null, "+", blineRight, blineTopAdder, containerSize, this.lastBline.closest("svg").parentElement, "Add Measure");
|
76
|
+
this.drawButton("measureRemover", null, "-", blineRight, blineTopRemover, containerSize, this.lastBline.closest("svg").parentElement, "Remove Measure");
|
87
77
|
}
|
88
78
|
drawStaffManipulators() {
|
89
79
|
this.vrvSVG.querySelector(".measure").querySelectorAll(".staff").forEach(s => {
|
90
|
-
var rootBBox = this.vrvSVG.getBoundingClientRect()
|
80
|
+
//var rootBBox = this.vrvSVG.getBoundingClientRect()
|
91
81
|
var refStaffCoords = this.getStaffManipulatorCoords(s);
|
92
82
|
var refStaffX = refStaffCoords.x;
|
93
83
|
var refStaffYTop = refStaffCoords.yTop;
|
94
84
|
var refStaffYBottom = refStaffCoords.yBottom;
|
95
85
|
var refStaffWidth = refStaffCoords.width;
|
96
86
|
var refStaffHeight = refStaffCoords.height;
|
97
|
-
var posX = refStaffX - refStaffWidth * 0.5
|
98
|
-
var topY = refStaffYTop - refStaffHeight * 0.2
|
87
|
+
var posX = refStaffX - refStaffWidth * 0.5; //- rootBBox.x
|
88
|
+
var topY = refStaffYTop - refStaffHeight * 0.2; //- rootBBox.y
|
99
89
|
var containerSize = refStaffHeight / 4;
|
100
90
|
this.drawButton(null, "addStaff above", "+", posX, topY, containerSize, this.vrvSVG, s.id);
|
101
91
|
if (parseInt(s.getAttribute("n")) > 1) {
|
102
|
-
posX = refStaffX
|
92
|
+
posX = refStaffX; //- rootBBox.x
|
103
93
|
this.drawButton(null, "removeStaff above", "-", posX, topY, containerSize, this.vrvSVG, s.id);
|
104
94
|
}
|
105
|
-
posX = refStaffX - refStaffWidth * 0.5
|
106
|
-
var bottomY = refStaffYBottom
|
95
|
+
posX = refStaffX - refStaffWidth * 0.5; //- rootBBox.x
|
96
|
+
var bottomY = refStaffYBottom; //- rootBBox.y
|
107
97
|
var containerSize = (refStaffHeight / 4);
|
108
98
|
this.drawButton(null, "addStaff below", "+", posX, bottomY, containerSize, this.vrvSVG, s.id);
|
109
99
|
var staffCount = s.parentElement.querySelectorAll(".staff");
|
110
100
|
if (parseInt(s.getAttribute("n")) !== staffCount.length) {
|
111
|
-
posX = refStaffX
|
101
|
+
posX = refStaffX; //- rootBBox.x
|
112
102
|
this.drawButton(null, "removeStaff below", "-", posX, bottomY, containerSize, this.vrvSVG, s.id);
|
113
103
|
}
|
114
104
|
});
|
115
105
|
}
|
106
|
+
/**
|
107
|
+
* Draw 4 Buttons at the beginning of each new Line
|
108
|
+
*/
|
109
|
+
drawVoiceSelectors() {
|
110
|
+
//var rootBBox = this.vrvSVG.getBoundingClientRect()
|
111
|
+
this.vrvSVG.querySelectorAll(".page").forEach(p => {
|
112
|
+
p.querySelector(".measure").querySelectorAll(".staff").forEach(staff => {
|
113
|
+
var _a;
|
114
|
+
var bbox = coordinates_1.getDOMMatrixCoordinates(staff.querySelector(".staffLine"), this.vrvSVG); //staff.querySelector(".staffLine").getBoundingClientRect()
|
115
|
+
var x = bbox.left; //- rootBBox.x
|
116
|
+
var yTop = bbox.top; //- rootBBox.y
|
117
|
+
var yBottom = coordinates_1.getDOMMatrixCoordinates(Array.from(staff.querySelectorAll(".staffLine")).reverse()[0], this.vrvSVG).bottom; //Array.from(staff.querySelectorAll(".staffLine")).reverse()[0].getBoundingClientRect().bottom - rootBBox.y
|
118
|
+
var staffHeight = (yBottom - yTop);
|
119
|
+
yTop -= staffHeight * 0.20; // center the boxes
|
120
|
+
var btnHeight = (staffHeight / 4) * 1.5;
|
121
|
+
for (let i = 0; i < 4; i++) {
|
122
|
+
var btn = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
123
|
+
var btnRect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
124
|
+
var btnText = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
125
|
+
btnText.textContent = (i + 1).toString();
|
126
|
+
btn.setAttribute("x", "3px");
|
127
|
+
btn.setAttribute("y", (yTop + btnHeight * i).toString());
|
128
|
+
btn.setAttribute("height", btnHeight.toString());
|
129
|
+
btn.setAttribute("width", btnHeight.toString());
|
130
|
+
btn.classList.add("voiceBtn");
|
131
|
+
btn.classList.add("manipulator");
|
132
|
+
btn.setAttribute("staffN", staff.getAttribute("n"));
|
133
|
+
btn.setAttribute("btnN", (i + 1).toString());
|
134
|
+
btn.setAttribute("id", "voiceSelect-" + staff.getAttribute("n") + "-" + (i + 1).toString());
|
135
|
+
//btnText is relative to btn
|
136
|
+
btnText.setAttribute("x", "30%");
|
137
|
+
btnText.setAttribute("y", "80%");
|
138
|
+
btn.append(btnRect);
|
139
|
+
btn.append(btnText);
|
140
|
+
(_a = this.interactionOverlay.querySelector("#manipulatorCanvas")) === null || _a === void 0 ? void 0 : _a.append(btn);
|
141
|
+
}
|
142
|
+
});
|
143
|
+
});
|
144
|
+
}
|
116
145
|
/**
|
117
146
|
* Get Coords for staf manipulators, since some browsers (Firefox) have problems with bounding boxes
|
118
147
|
* @param referenceStaff Staff beside which the staff manipulator should be placed
|
@@ -126,20 +155,21 @@ class ScoreManipulator {
|
|
126
155
|
var width;
|
127
156
|
var height;
|
128
157
|
if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1) {
|
129
|
-
bbox = referenceStaff.querySelector(".staffLine").getBoundingClientRect()
|
158
|
+
bbox = coordinates_1.getDOMMatrixCoordinates(referenceStaff, this.vrvSVG); //referenceStaff.querySelector(".staffLine").getBoundingClientRect()
|
130
159
|
x = bbox.left;
|
131
160
|
yTop = bbox.top;
|
132
|
-
yBottom = Array.from(referenceStaff.querySelectorAll(".staffLine")).reverse()[0].getBoundingClientRect().bottom
|
161
|
+
yBottom = coordinates_1.getDOMMatrixCoordinates(Array.from(referenceStaff.querySelectorAll(".staffLine")).reverse()[0], this.vrvSVG).bottom; //Array.from(referenceStaff.querySelectorAll(".staffLine")).reverse()[0].getBoundingClientRect().bottom
|
133
162
|
}
|
134
163
|
else {
|
135
|
-
bbox = referenceStaff.querySelector(".clef").getBoundingClientRect()
|
164
|
+
bbox = bbox = coordinates_1.getDOMMatrixCoordinates(referenceStaff.querySelector(".clef"), this.vrvSVG); //referenceStaff.querySelector(".clef").getBoundingClientRect()
|
136
165
|
x = bbox.left;
|
137
166
|
yTop = bbox.top;
|
138
167
|
yBottom = bbox.bottom;
|
139
168
|
}
|
140
|
-
|
141
|
-
|
142
|
-
|
169
|
+
const clefCoords = coordinates_1.getDOMMatrixCoordinates(referenceStaff.querySelector(".clef"), this.vrvSVG);
|
170
|
+
//height = referenceStaff.querySelector(".clef").getBoundingClientRect().height
|
171
|
+
//width = referenceStaff.querySelector(".clef").getBoundingClientRect().width
|
172
|
+
return { x: x, yTop: yTop, yBottom: yBottom, width: clefCoords.width, height: clefCoords.height };
|
143
173
|
}
|
144
174
|
setMEI(mei) {
|
145
175
|
this.mei = mei;
|
@@ -7,7 +7,8 @@ const interactjs_1 = require("interactjs");
|
|
7
7
|
const constants_1 = require("../constants");
|
8
8
|
const meioperations = require("../utils/MEIOperations");
|
9
9
|
const cq = require("../utils/convenienceQueries");
|
10
|
-
const
|
10
|
+
const ReactWrapper = require("../utils/ReactWrapper");
|
11
|
+
const buttonStyleDarkOutline = "btn btn-outline-dark btn-md";
|
11
12
|
const buttonStyleDark = "btn btn-dark btn-md";
|
12
13
|
const smuflFont = "smufl";
|
13
14
|
const alterBtn = "alterBtn";
|
@@ -16,9 +17,9 @@ const tabFlag = "tabBtn";
|
|
16
17
|
class Tabbar {
|
17
18
|
//private task: Evaluation
|
18
19
|
constructor(options = null, containerId) {
|
19
|
-
this.
|
20
|
+
this.createAnnotListHandler = (function createAnnotListHandler(e) {
|
20
21
|
var t = e.target;
|
21
|
-
if (t.closest(".
|
22
|
+
if (t.closest(".vibe-container").id !== this.containerId)
|
22
23
|
return;
|
23
24
|
this.createAnnotList(e);
|
24
25
|
}).bind(this);
|
@@ -178,9 +179,17 @@ class Tabbar {
|
|
178
179
|
var clefSelectItem = dc.makeNewAccordionItem("sidebarList", "selectClef", "selectClefHeader", "selectClefBtn", "Clef", buttonStyleDark, "selectClefDiv");
|
179
180
|
var clefList = dc.makeNewDiv("clefList", "list-group flex-fill");
|
180
181
|
clefSelectItem.querySelector("#selectClefDiv").appendChild(clefList);
|
182
|
+
clefList.appendChild(dc.makeNewAElement("𝄟", "GClefOctUp", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
181
183
|
clefList.appendChild(dc.makeNewAElement("", "GClef", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
182
|
-
clefList.appendChild(dc.makeNewAElement("&#
|
184
|
+
clefList.appendChild(dc.makeNewAElement("𝄠", "GClefOctDown", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
185
|
+
clefList.appendChild(dc.makeNewAElement("Soprano ", "CClefSoprano", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
186
|
+
clefList.appendChild(dc.makeNewAElement("Mezzo ", "CClefMezzo", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
187
|
+
clefList.appendChild(dc.makeNewAElement("Alto ", "CClefAlto", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
188
|
+
clefList.appendChild(dc.makeNewAElement("Tenor ", "CClefTenor", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
189
|
+
clefList.appendChild(dc.makeNewAElement("Bariton ", "CClefBariton", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
190
|
+
clefList.appendChild(dc.makeNewAElement("𝄣", "FClefOctUp", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
183
191
|
clefList.appendChild(dc.makeNewAElement("", "FClef", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
192
|
+
clefList.appendChild(dc.makeNewAElement("𝄤", "FClefOctDown", "list-group-item list-group-item-action " + smuflFont, "#", true));
|
184
193
|
return clefSelectItem;
|
185
194
|
}
|
186
195
|
createTimeSigAccItem() {
|
@@ -267,6 +276,9 @@ class Tabbar {
|
|
267
276
|
var text = c.querySelector(".annotDiv").textContent || c.querySelector(".annotDiv").getAttribute("data-text");
|
268
277
|
var a = dc.makeNewAElement(text, "", "list-group-item list-group-item-action list-group-item-primary", "#");
|
269
278
|
a.setAttribute("refId", c.id);
|
279
|
+
if (c.querySelector(".annotDiv").style.backgroundColor.length > 0) {
|
280
|
+
a.style.backgroundColor = c.querySelector(".annotDiv").style.backgroundColor;
|
281
|
+
}
|
270
282
|
//a.setAttribute("contenteditable", "true")
|
271
283
|
a.addEventListener("click", function () {
|
272
284
|
var _a;
|
@@ -306,6 +318,7 @@ class Tabbar {
|
|
306
318
|
this.annotationTab = cq.getContainer(this.containerId).querySelector("#annotationTabGroup");
|
307
319
|
this.annotationTab.append(dc.makeNewButton("Annotation", "annotationTabBtn", buttonStyleDarkOutline + " " + tabFlag));
|
308
320
|
this.noteButtonGroup = cq.getContainer(this.containerId).querySelector("#noteGroup");
|
321
|
+
this.noteButtonGroup.append(dc.makeNewButton("𝅜", "breveNote", buttonStyleDarkOutline + " " + smuflFont, "", true));
|
309
322
|
this.noteButtonGroup.append(dc.makeNewButton("𝅝", "fullNote", buttonStyleDarkOutline + " " + smuflFont, "", true));
|
310
323
|
this.noteButtonGroup.append(dc.makeNewButton("𝅗𝅥", "halfNote", buttonStyleDarkOutline + " " + smuflFont, "", true));
|
311
324
|
this.noteButtonGroup.append(dc.makeNewButton("𝅘𝅥", "quarterNote", buttonStyleDarkOutline + " " + smuflFont + " selected", "", true));
|
@@ -336,13 +349,17 @@ class Tabbar {
|
|
336
349
|
this.zoomGroup = cq.getContainer(this.containerId).querySelector("#zoomGroup");
|
337
350
|
this.zoomGroup.append(dc.makeNewButton("", "zoomOutBtn", buttonStyleDarkOutline));
|
338
351
|
this.zoomGroup.append(dc.makeNewButton("", "zoomInBtn", buttonStyleDarkOutline));
|
339
|
-
|
340
|
-
|
352
|
+
this.colorGroup = cq.getContainer(this.containerId).querySelector("#colorGroup");
|
353
|
+
function handleColor(color) {
|
354
|
+
this.colorGroup.setAttribute("selectedColor", color);
|
355
|
+
this.colorGroup.dispatchEvent(new Event("change"));
|
356
|
+
}
|
357
|
+
this.colorGroup.append(ReactWrapper.createColorPicker("colorPicker", handleColor.bind(this)));
|
341
358
|
this.fileSelectGroup = cq.getContainer(this.containerId).querySelector("#fileSelectGroup");
|
342
359
|
this.fileSelectGroup.append(dc.makeNewInput("importAudioFile", "file", ""));
|
343
360
|
this.fileSelectGroup.append(dc.makeNewButton("Import Audiofile", "importAudioFileBtn", buttonStyleDarkOutline));
|
344
361
|
this.fileSelectGroup.append(dc.makeNewInput("importXML", "file", ""));
|
345
|
-
this.fileSelectGroup.append(dc.makeNewButton("Import
|
362
|
+
this.fileSelectGroup.append(dc.makeNewButton("Import Score", "importXMLBtn", buttonStyleDarkOutline));
|
346
363
|
this.fileSelectGroup.append(dc.makeNewButton("Export MEI", "exportFileBtn", buttonStyleDarkOutline));
|
347
364
|
var showBBToggle = dc.makeNewToggle("showBB", buttonStyleDark, "BBoxes", "showBBDiv");
|
348
365
|
this.setToggleLogic(showBBToggle, function () { cq.getContainer(that.containerId).classList.add("debug"); }, function () { cq.getContainer(that.containerId).classList.remove("debug"); });
|
@@ -382,7 +399,7 @@ class Tabbar {
|
|
382
399
|
}
|
383
400
|
createInsertSelect() {
|
384
401
|
//InsertSelect DropdownMenu
|
385
|
-
this.insertSelectGroup = dc.makeNewDiv("insertGroup", "customGroup btn-group-
|
402
|
+
this.insertSelectGroup = dc.makeNewDiv("insertGroup", "customGroup btn-group-md me-2 h-100", { role: "group" });
|
386
403
|
var toggle = dc.makeNewToggle("insertToggle", buttonStyleDarkOutline, "Replace", "insertToggleDiv");
|
387
404
|
toggle.addEventListener("click", function (e) {
|
388
405
|
e.preventDefault();
|
@@ -403,14 +420,14 @@ class Tabbar {
|
|
403
420
|
this.insertSelectGroup.append(toggle);
|
404
421
|
}
|
405
422
|
createButtonsAnnotationMode() {
|
406
|
-
this.annotGroupKM = dc.makeNewDiv("annotGroupKM", "customGroup btn-group-
|
423
|
+
this.annotGroupKM = dc.makeNewDiv("annotGroupKM", "customGroup btn-group-md me-2 h-100", { role: "group" });
|
407
424
|
this.annotGroupKM.append(dc.makeNewButton("Text", "staticTextButton", buttonStyleDarkOutline));
|
408
|
-
this.annotGroupKM.append(dc.makeNewButton("
|
425
|
+
this.annotGroupKM.append(dc.makeNewButton("Sticky Text", "linkedAnnotButton", buttonStyleDarkOutline + " selected"));
|
409
426
|
this.annotGroupKM.append(dc.makeNewButton("Harmony", "harmonyAnnotButton", buttonStyleDarkOutline));
|
410
427
|
this.annotGroupKM.addEventListener("click", this.exclusiveSelectHandler);
|
411
428
|
}
|
412
429
|
createArticualtionButtons() {
|
413
|
-
this.articGroup = dc.makeNewDiv("articGroup", "customGroup btn-group-
|
430
|
+
this.articGroup = dc.makeNewDiv("articGroup", "customGroup btn-group-md me-2 h-100", { role: "group" });
|
414
431
|
this.articGroup.append(dc.makeNewButton(".", "staccatoBtn", buttonStyleDarkOutline));
|
415
432
|
this.articGroup.append(dc.makeNewButton("_", "tenutoBtn", buttonStyleDarkOutline));
|
416
433
|
this.articGroup.append(dc.makeNewButton("𝅿", "marcatoBtn", buttonStyleDarkOutline + " " + smuflFont, "", true));
|
@@ -431,6 +448,7 @@ class Tabbar {
|
|
431
448
|
//further utils
|
432
449
|
btnToolbar.appendChild(this.soundGroup);
|
433
450
|
btnToolbar.appendChild(this.zoomGroup);
|
451
|
+
btnToolbar.append(this.colorGroup);
|
434
452
|
//btnToolbar.appendChild(this.midiSelectGroup)
|
435
453
|
btnToolbar.appendChild(this.fileSelectGroup);
|
436
454
|
}
|
@@ -460,7 +478,7 @@ class Tabbar {
|
|
460
478
|
});
|
461
479
|
// achtung: nie preventDefault in einem Document anwenden
|
462
480
|
document.addEventListener("keydown", this.closeHandlerKey);
|
463
|
-
//document.getElementsByClassName("
|
481
|
+
//document.getElementsByClassName("vibe-container")[0]?.addEventListener("click", this.closeHandlerMouse)
|
464
482
|
cq.getContainer(this.containerId).querySelectorAll("#dotGroup button, #noteGroup button, #modGroup button, #accidGroup Button").forEach(el => {
|
465
483
|
el.addEventListener("click", this.exclusiveSelectHandler);
|
466
484
|
});
|
@@ -477,7 +495,7 @@ class Tabbar {
|
|
477
495
|
ac.classList.add("show");
|
478
496
|
});
|
479
497
|
});
|
480
|
-
cq.getContainer(this.containerId).addEventListener("annotChanged", this.
|
498
|
+
cq.getContainer(this.containerId).addEventListener("annotChanged", this.createAnnotListHandler, true);
|
481
499
|
//Markup/ XML FileSelection
|
482
500
|
cq.getContainer(this.containerId).querySelector("#importXMLBtn").addEventListener("click", function () {
|
483
501
|
var impF = this.parentElement.querySelector("#importXML");
|
@@ -528,7 +546,7 @@ class Tabbar {
|
|
528
546
|
+ ("0" + d.getMinutes()).slice(-2)
|
529
547
|
+ ("0" + d.getSeconds()).slice(-2)
|
530
548
|
+ "_"
|
531
|
-
+ "
|
549
|
+
+ "vibeScore_" + that.containerId + ".mei";
|
532
550
|
that.download(fileName, mei);
|
533
551
|
});
|
534
552
|
});
|
@@ -541,16 +559,18 @@ class Tabbar {
|
|
541
559
|
* @returns
|
542
560
|
*/
|
543
561
|
align(blob, file) {
|
544
|
-
var _a;
|
545
562
|
this.audioBlob = blob;
|
546
563
|
this.audioFile = file;
|
547
|
-
if (!(this.
|
564
|
+
if (!(this.audioBlob && this.audioFile))
|
548
565
|
return;
|
549
|
-
this.
|
550
|
-
|
566
|
+
this.fileSelectGroup.querySelectorAll("#audioSlider, #recordAlignment, #exportAlignment").forEach(el => el.remove());
|
567
|
+
var recBtn = dc.makeNewToggle("recordAlignment", buttonStyleDarkOutline + " " + smuflFont, "rec", "recordDiv");
|
551
568
|
var audioSlider = dc.makeNewAudioSlider("audioSlider", "", URL.createObjectURL(this.audioFile));
|
569
|
+
var exportAlignBtn = dc.makeNewButton("Export Alignment", "exportAlignment", buttonStyleDarkOutline + " " + smuflFont);
|
552
570
|
this.fileSelectGroup.prepend(audioSlider);
|
553
|
-
|
571
|
+
this.fileSelectGroup.prepend(recBtn);
|
572
|
+
this.fileSelectGroup.prepend(exportAlignBtn);
|
573
|
+
this.alignCallback(this.audioBlob);
|
554
574
|
}
|
555
575
|
download(file, text) {
|
556
576
|
//creating an invisible element
|
@@ -567,14 +587,14 @@ class Tabbar {
|
|
567
587
|
el.removeEventListener("click", this.closeHandlerMouse);
|
568
588
|
});
|
569
589
|
document.removeEventListener("keydown", this.closeHandlerKey);
|
570
|
-
cq.getContainer(this.containerId).querySelectorAll(".btn-group-
|
590
|
+
cq.getContainer(this.containerId).querySelectorAll(".btn-group-md button").forEach(el => {
|
571
591
|
el.removeEventListener("click", this.exclusiveSelectHandler);
|
572
592
|
});
|
573
593
|
cq.getContainer(this.containerId).querySelector("#toggleSidebar").removeEventListener("click", this.sidebarHandler);
|
574
594
|
cq.getContainer(this.containerId).querySelectorAll(["#insertDropdown a", "." + tabFlag].join(",")).forEach(a => {
|
575
595
|
a.removeEventListener("click", this.customToolbarHandler);
|
576
596
|
});
|
577
|
-
cq.getContainer(this.containerId).removeEventListener("annotChanged", this.
|
597
|
+
cq.getContainer(this.containerId).removeEventListener("annotChanged", this.createAnnotListHandler);
|
578
598
|
interactjs_1.default("#annotList").unset();
|
579
599
|
}
|
580
600
|
closeDropdown(ddButton) {
|
@@ -20,7 +20,7 @@ class Toolbar {
|
|
20
20
|
constructor(options = null, containerId) {
|
21
21
|
this.createAnnotListFunction = (function (e) {
|
22
22
|
var t = e.target;
|
23
|
-
if (t.closest(".
|
23
|
+
if (t.closest(".vibe-container").id !== this.containerId)
|
24
24
|
return;
|
25
25
|
this.createAnnotList(e);
|
26
26
|
}).bind(this);
|
@@ -464,7 +464,7 @@ class Toolbar {
|
|
464
464
|
});
|
465
465
|
// achtung: nie preventDefault in einem Document anwenden
|
466
466
|
document.addEventListener("keydown", this.closeHandlerKey);
|
467
|
-
//document.getElementsByClassName("
|
467
|
+
//document.getElementsByClassName("vibe-container")[0]?.addEventListener("click", this.closeHandlerMouse)
|
468
468
|
cq.getContainer(this.containerId).querySelectorAll("#dotGroup button, #noteGroup button, #modGroup button").forEach(el => {
|
469
469
|
el.addEventListener("click", this.exclusiveSelectHandler);
|
470
470
|
});
|
@@ -516,7 +516,7 @@ class Toolbar {
|
|
516
516
|
+ ("0" + d.getMinutes()).slice(-2)
|
517
517
|
+ ("0" + d.getSeconds()).slice(-2)
|
518
518
|
+ "_"
|
519
|
-
+ "
|
519
|
+
+ "vibeScore_" + that.containerId + ".mei";
|
520
520
|
that.download(fileName, mei);
|
521
521
|
});
|
522
522
|
});
|
@@ -536,7 +536,7 @@ class Toolbar {
|
|
536
536
|
el.removeEventListener("click", this.closeHandlerMouse);
|
537
537
|
});
|
538
538
|
document.removeEventListener("keydown", this.closeHandlerKey);
|
539
|
-
//document.getElementsByClassName("
|
539
|
+
//document.getElementsByClassName("vibe-container")[0].removeEventListener("click", this.closeHandlerMouse)
|
540
540
|
cq.getContainer(this.containerId).querySelectorAll(".btn-group-sm button").forEach(el => {
|
541
541
|
el.removeEventListener("click", this.exclusiveSelectHandler);
|
542
542
|
});
|