vibe-editor 0.0.3 → 0.0.4
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 +1 -1
- package/src/scripts/js/Core.js +4 -4
- package/src/scripts/js/assets/mei_template.js +2 -2
- package/src/scripts/js/gui/Annotations.js +1 -1
- package/src/scripts/js/gui/HarmonyLabel.js +1 -1
- package/src/scripts/js/gui/ScoreManipulator.js +7 -7
- package/src/scripts/js/gui/Tabbar.js +1 -1
- package/src/scripts/js/gui/TempoLabel.js +1 -1
- package/src/scripts/js/gui/Toolbar.js +1 -1
- package/src/scripts/js/handlers/AnnotationChangeHandler.js +3 -3
- package/src/scripts/js/handlers/CustomAnnotationShapeDrawer.js +2 -2
- package/src/scripts/js/handlers/InsertModeHandler.js +4 -4
- package/src/scripts/js/handlers/KeyModeHandler.js +1 -1
- package/src/scripts/js/handlers/LabelHandler.js +1 -1
- package/src/scripts/js/handlers/NoteDragHandler.js +1 -1
- package/src/scripts/js/handlers/{SideBarHandler.js → SidebarHandler.js} +1 -1
- package/src/scripts/js/handlers/TooltipHandler.js +1 -1
- package/src/scripts/js/utils/MEIOperations.js +22 -22
- package/src/scripts/js/utils/Mouse2SVG.js +2 -2
- package/src/scripts/js/utils/ReactWrapper.js +1 -1
- package/src/scripts/js/utils/SVGEditor.js +2 -2
package/package.json
CHANGED
package/src/scripts/js/Core.js
CHANGED
@@ -194,7 +194,7 @@ class Core {
|
|
194
194
|
return new Promise((resolve, reject) => {
|
195
195
|
var _a;
|
196
196
|
var message = {
|
197
|
-
id:
|
197
|
+
id: random_1.uuidv4(),
|
198
198
|
action: 'renderToSVG',
|
199
199
|
pageNo: pageNo
|
200
200
|
};
|
@@ -307,7 +307,7 @@ class Core {
|
|
307
307
|
}
|
308
308
|
//just render the data once to make pagecount accessible
|
309
309
|
var message = {
|
310
|
-
id:
|
310
|
+
id: random_1.uuidv4(),
|
311
311
|
action: 'renderData',
|
312
312
|
mei: d,
|
313
313
|
isUrl: u
|
@@ -549,7 +549,7 @@ class Core {
|
|
549
549
|
return new Promise((resolve, reject) => {
|
550
550
|
const message = {
|
551
551
|
action: "getMEI",
|
552
|
-
id:
|
552
|
+
id: random_1.uuidv4()
|
553
553
|
};
|
554
554
|
var response;
|
555
555
|
response = this.verovioWrapper.setMessage(message);
|
@@ -566,7 +566,7 @@ class Core {
|
|
566
566
|
return new Promise((resolve, reject) => {
|
567
567
|
const message = {
|
568
568
|
action: "renderToMidi",
|
569
|
-
id:
|
569
|
+
id: random_1.uuidv4()
|
570
570
|
};
|
571
571
|
var response = this.verovioWrapper.setMessage(message);
|
572
572
|
if (response.midi) {
|
@@ -134,7 +134,7 @@ class MeiTemplate {
|
|
134
134
|
}
|
135
135
|
createTempo(mm, mmUnit, tstamp = null, startId = null) {
|
136
136
|
var newElement = document.createElementNS(constants_1.constants._MEINS_, "tempo");
|
137
|
-
newElement.setAttribute("id",
|
137
|
+
newElement.setAttribute("id", random_1.uuidv4());
|
138
138
|
newElement.setAttribute("place", "above");
|
139
139
|
if (startId === null && tstamp === null) {
|
140
140
|
throw new Error("Tempo MUST either have timestamp or startId");
|
@@ -148,7 +148,7 @@ class MeiTemplate {
|
|
148
148
|
newElement.setAttribute("midi.bpm", (parseFloat(mm) * parseFloat(mmUnit)).toString());
|
149
149
|
newElement.setAttribute("staff", "1");
|
150
150
|
var rend = document.createElementNS(constants_1.constants._MEINS_, "rend");
|
151
|
-
rend.setAttribute("id",
|
151
|
+
rend.setAttribute("id", random_1.uuidv4());
|
152
152
|
rend.setAttribute("fontname", "VerovioText");
|
153
153
|
rend.textContent = "__";
|
154
154
|
newElement.appendChild(rend);
|
@@ -292,7 +292,7 @@ class Annotations {
|
|
292
292
|
var posy = pt.y; //matrixTransform(rootMatrix).y //e.pageY - this.rootBBox.y - window.pageYOffset
|
293
293
|
var annotationTarget = this.m2s.findScoreTarget(posx, posy, false);
|
294
294
|
var textGroup = document.createElementNS(constants_1.constants._SVGNS_, "g");
|
295
|
-
textGroup.setAttribute("id",
|
295
|
+
textGroup.setAttribute("id", random_1.uuidv4());
|
296
296
|
textGroup.setAttribute("targetId", annotationTarget.id);
|
297
297
|
var text = document.createElementNS(constants_1.constants._SVGNS_, "svg");
|
298
298
|
if (isLinked)
|
@@ -41,7 +41,7 @@ class HarmonyLabel {
|
|
41
41
|
}
|
42
42
|
createElement(inputString) {
|
43
43
|
this.element = this.currentMEI.createElement("harm");
|
44
|
-
this.element.setAttribute("id",
|
44
|
+
this.element.setAttribute("id", random_1.uuidv4());
|
45
45
|
this.element.setAttribute("place", "below");
|
46
46
|
Array.from(this.element.children).forEach(c => {
|
47
47
|
c.remove();
|
@@ -67,7 +67,7 @@ class ScoreManipulator {
|
|
67
67
|
}
|
68
68
|
drawMeasureManipulators() {
|
69
69
|
this.lastBline = Array.from(this.vrvSVG.querySelectorAll(".barLine")).reverse()[0].querySelector("path");
|
70
|
-
var lastBlineRect =
|
70
|
+
var lastBlineRect = coordinates_1.getDOMMatrixCoordinates(this.lastBline, this.vrvSVG);
|
71
71
|
var blineTopAdder = lastBlineRect.top;
|
72
72
|
var blineTopRemover = lastBlineRect.top + lastBlineRect.height / 2;
|
73
73
|
var blineRight = lastBlineRect.right;
|
@@ -111,10 +111,10 @@ class ScoreManipulator {
|
|
111
111
|
this.vrvSVG.querySelectorAll(".page").forEach(p => {
|
112
112
|
p.querySelector(".measure").querySelectorAll(".staff").forEach(staff => {
|
113
113
|
var _a;
|
114
|
-
var bbox =
|
114
|
+
var bbox = coordinates_1.getDOMMatrixCoordinates(staff.querySelector(".staffLine"), this.vrvSVG); //staff.querySelector(".staffLine").getBoundingClientRect()
|
115
115
|
var x = bbox.left; //- rootBBox.x
|
116
116
|
var yTop = bbox.top; //- rootBBox.y
|
117
|
-
var yBottom =
|
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
118
|
var staffHeight = (yBottom - yTop);
|
119
119
|
yTop -= staffHeight * 0.20; // center the boxes
|
120
120
|
var btnHeight = (staffHeight / 4) * 1.5;
|
@@ -155,18 +155,18 @@ class ScoreManipulator {
|
|
155
155
|
var width;
|
156
156
|
var height;
|
157
157
|
if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1) {
|
158
|
-
bbox =
|
158
|
+
bbox = coordinates_1.getDOMMatrixCoordinates(referenceStaff, this.vrvSVG); //referenceStaff.querySelector(".staffLine").getBoundingClientRect()
|
159
159
|
x = bbox.left;
|
160
160
|
yTop = bbox.top;
|
161
|
-
yBottom =
|
161
|
+
yBottom = coordinates_1.getDOMMatrixCoordinates(Array.from(referenceStaff.querySelectorAll(".staffLine")).reverse()[0], this.vrvSVG).bottom; //Array.from(referenceStaff.querySelectorAll(".staffLine")).reverse()[0].getBoundingClientRect().bottom
|
162
162
|
}
|
163
163
|
else {
|
164
|
-
bbox = bbox =
|
164
|
+
bbox = bbox = coordinates_1.getDOMMatrixCoordinates(referenceStaff.querySelector(".clef"), this.vrvSVG); //referenceStaff.querySelector(".clef").getBoundingClientRect()
|
165
165
|
x = bbox.left;
|
166
166
|
yTop = bbox.top;
|
167
167
|
yBottom = bbox.bottom;
|
168
168
|
}
|
169
|
-
const clefCoords =
|
169
|
+
const clefCoords = coordinates_1.getDOMMatrixCoordinates(referenceStaff.querySelector(".clef"), this.vrvSVG);
|
170
170
|
//height = referenceStaff.querySelector(".clef").getBoundingClientRect().height
|
171
171
|
//width = referenceStaff.querySelector(".clef").getBoundingClientRect().width
|
172
172
|
return { x: x, yTop: yTop, yBottom: yBottom, width: clefCoords.width, height: clefCoords.height };
|
@@ -596,7 +596,7 @@ class Tabbar {
|
|
596
596
|
a.removeEventListener("click", this.customToolbarHandler);
|
597
597
|
});
|
598
598
|
cq.getContainer(this.containerId).removeEventListener("annotChanged", this.createAnnotListHandler);
|
599
|
-
|
599
|
+
interactjs_1.default("#annotList").unset();
|
600
600
|
}
|
601
601
|
closeDropdown(ddButton) {
|
602
602
|
if (ddButton.classList.contains("show")) {
|
@@ -29,7 +29,7 @@ class TempoLabel {
|
|
29
29
|
createElement(inputString) {
|
30
30
|
if (typeof this.element === "undefined") {
|
31
31
|
this.element = this.currentMEI.createElement("tempo");
|
32
|
-
this.element.setAttribute("id",
|
32
|
+
this.element.setAttribute("id", random_1.uuidv4());
|
33
33
|
}
|
34
34
|
Array.from(this.element.children).forEach(c => {
|
35
35
|
c.remove();
|
@@ -548,7 +548,7 @@ class Toolbar {
|
|
548
548
|
// el.removeEventListener("click", this.sidebarHandler)
|
549
549
|
// })
|
550
550
|
cq.getContainer(this.containerId).removeEventListener("annotChanged", this.createAnnotListFunction);
|
551
|
-
|
551
|
+
interactjs_1.default("#annotList").unset();
|
552
552
|
}
|
553
553
|
closeDropdown(ddButton) {
|
554
554
|
if (ddButton.classList.contains("show")) {
|
@@ -31,7 +31,7 @@ class AnnotationChangeHandler {
|
|
31
31
|
setListeners() {
|
32
32
|
//if(document.getElementById(this.containerId).querySelector(".sidebar.openSidebar") != null) return
|
33
33
|
var that = this;
|
34
|
-
this.shapeListener =
|
34
|
+
this.shapeListener = interactjs_1.default("#" + this.containerId + " #interactionOverlay .customAnnotShape")
|
35
35
|
.resizable({
|
36
36
|
// resize from all edges and corners
|
37
37
|
edges: { left: true, right: true, bottom: true, top: true },
|
@@ -62,7 +62,7 @@ class AnnotationChangeHandler {
|
|
62
62
|
})
|
63
63
|
]
|
64
64
|
});
|
65
|
-
this.textListener =
|
65
|
+
this.textListener = interactjs_1.default("#" + this.containerId + " .annotText")
|
66
66
|
.resizable({
|
67
67
|
// resize from all edges and corners
|
68
68
|
edges: { left: true, right: true, bottom: true, top: true },
|
@@ -93,7 +93,7 @@ class AnnotationChangeHandler {
|
|
93
93
|
})
|
94
94
|
]
|
95
95
|
});
|
96
|
-
this.lineListener =
|
96
|
+
this.lineListener = interactjs_1.default("#" + this.containerId + " #interactionOverlay .lineDragRect.x1")
|
97
97
|
.draggable({
|
98
98
|
listeners: {
|
99
99
|
move: this.dragLineListener.bind(this),
|
@@ -67,7 +67,7 @@ class CustomAnnotationShapeDrawer {
|
|
67
67
|
this.updateCallback();
|
68
68
|
}
|
69
69
|
initRect(ulx, uly) {
|
70
|
-
this.shapeID =
|
70
|
+
this.shapeID = random_1.uuidv4();
|
71
71
|
this.canvas.append('rect')
|
72
72
|
.attr('x', ulx)
|
73
73
|
.attr('y', uly)
|
@@ -78,7 +78,7 @@ class CustomAnnotationShapeDrawer {
|
|
78
78
|
this.shape = document.getElementById(this.shapeID);
|
79
79
|
}
|
80
80
|
initCircle(cx, cy) {
|
81
|
-
this.shapeID =
|
81
|
+
this.shapeID = random_1.uuidv4();
|
82
82
|
this.canvas.append('ellipse')
|
83
83
|
.attr('cx', cx)
|
84
84
|
.attr('cy', cy)
|
@@ -245,8 +245,8 @@ class InsertModeHandler {
|
|
245
245
|
}
|
246
246
|
that.m2s.setDurationNewNote(dur);
|
247
247
|
if (that.m2s.setMarkedNoteDurations(dur)) {
|
248
|
-
|
249
|
-
var mei =
|
248
|
+
MEIOperations_1.cleanUp(that.m2s.getCurrentMei());
|
249
|
+
var mei = MEIConverter_1.restoreXmlIdTags(that.m2s.getCurrentMei());
|
250
250
|
that.loadDataCallback("", mei, false);
|
251
251
|
}
|
252
252
|
});
|
@@ -266,8 +266,8 @@ class InsertModeHandler {
|
|
266
266
|
}
|
267
267
|
that.m2s.setDotsNewNote(dots);
|
268
268
|
if (that.m2s.setMarkedNoteDots(dots)) {
|
269
|
-
|
270
|
-
var mei =
|
269
|
+
MEIOperations_1.cleanUp(that.m2s.getCurrentMei());
|
270
|
+
var mei = MEIConverter_1.restoreXmlIdTags(that.m2s.getCurrentMei());
|
271
271
|
that.loadDataCallback("", mei, false);
|
272
272
|
}
|
273
273
|
});
|
@@ -271,7 +271,7 @@ class KeyModeHandler {
|
|
271
271
|
this.setContainerId(this.containerId);
|
272
272
|
var newNote = {
|
273
273
|
pname: pname,
|
274
|
-
id:
|
274
|
+
id: random_1.uuidv4(),
|
275
275
|
dur: this.m2s.getDurationNewNote(),
|
276
276
|
dots: this.m2s.getDotsNewNote(),
|
277
277
|
oct: oct,
|
@@ -347,7 +347,7 @@ class LabelHandler {
|
|
347
347
|
}
|
348
348
|
createInputBox(posx, posy, targetId, targetClass) {
|
349
349
|
var textGroup = document.createElementNS(constants_1.constants._SVGNS_, "g");
|
350
|
-
textGroup.setAttribute("id",
|
350
|
+
textGroup.setAttribute("id", random_1.uuidv4());
|
351
351
|
textGroup.setAttribute("refElementId", targetId);
|
352
352
|
var text = document.createElementNS(constants_1.constants._SVGNS_, "svg");
|
353
353
|
text.classList.add("labelText");
|
@@ -12,7 +12,7 @@ class NoteDragHandler {
|
|
12
12
|
}
|
13
13
|
setListeners() {
|
14
14
|
var that = this;
|
15
|
-
this.noteDragListener =
|
15
|
+
this.noteDragListener = interactjs_1.default("#" + this.containerId + " #interactionOverlay .notehead rect")
|
16
16
|
.draggable({
|
17
17
|
startAxis: "y",
|
18
18
|
lockAxis: "y",
|
@@ -74,7 +74,7 @@ class SidebarHandler {
|
|
74
74
|
that.setSelectListeners();
|
75
75
|
}
|
76
76
|
}, false);
|
77
|
-
this.resizeListener =
|
77
|
+
this.resizeListener = interactjs_1.default("#" + this.containerId + " #sidebarContainer")
|
78
78
|
.resizable({
|
79
79
|
edges: { left: false, right: true, bottom: false, top: false },
|
80
80
|
listeners: {
|
@@ -206,7 +206,7 @@ function addToMEI(newSound, currentMEI, replace = false, scoreGraph = null) {
|
|
206
206
|
}
|
207
207
|
else {
|
208
208
|
chord = document.createElement("chord");
|
209
|
-
chord.setAttribute("id",
|
209
|
+
chord.setAttribute("id", random_1.uuidv4());
|
210
210
|
chord.setAttribute("dur", meiChordEl.getAttribute("dur"));
|
211
211
|
if (meiChordEl.getAttribute("dots") !== null) {
|
212
212
|
chord.setAttribute("dots", meiChordEl.getAttribute("dots"));
|
@@ -224,7 +224,7 @@ function addToMEI(newSound, currentMEI, replace = false, scoreGraph = null) {
|
|
224
224
|
if (Array.from(chord.querySelectorAll("note")).some(n => t.getAttribute("startid") === "#" + n.id)) {
|
225
225
|
if (!currentMEI.querySelector("tie[startid='#" + newNote.id + "']")) { // just make the tie once (since this can be called twice in recursion)
|
226
226
|
var addToChord = Object.assign({}, newNote);
|
227
|
-
addToChord.id =
|
227
|
+
addToChord.id = random_1.uuidv4();
|
228
228
|
var tieEnd = currentMEI.querySelector(t.getAttribute("endid"));
|
229
229
|
tieEnd = tieEnd.closest("chord") || tieEnd;
|
230
230
|
addToChord.chordElement = tieEnd;
|
@@ -408,7 +408,7 @@ function tieToNextMeasure(currentMEI, newElem, currMeiClone, replace, newSound)
|
|
408
408
|
changeDur(lastElement, newRatio);
|
409
409
|
// create new Element and if needed, new measure
|
410
410
|
var splittedElement = lastElement.tagName === "note" ? convertToNewNote(lastElement) : convertToNewChord(lastElement);
|
411
|
-
splittedElement.id =
|
411
|
+
splittedElement.id = random_1.uuidv4();
|
412
412
|
var newDur = ratioToDur(measureOverhead);
|
413
413
|
splittedElement.dur = newDur[0].toString();
|
414
414
|
splittedElement.dots = newDur[1].toString();
|
@@ -494,7 +494,7 @@ function doShiftRight(arr, meterRatio, currentLayer) {
|
|
494
494
|
}
|
495
495
|
else {
|
496
496
|
targetLayer = document.createElement("layer");
|
497
|
-
targetLayer.setAttribute("id", "layer-" +
|
497
|
+
targetLayer.setAttribute("id", "layer-" + random_1.uuidv4());
|
498
498
|
targetLayer.setAttribute("n", layerLevel);
|
499
499
|
targetStaff.appendChild(targetLayer);
|
500
500
|
}
|
@@ -512,7 +512,7 @@ function doShiftRight(arr, meterRatio, currentLayer) {
|
|
512
512
|
if (Number.isInteger(1 / chunkDurLeft) && Number.isInteger(1 / chunkDurRight)) {
|
513
513
|
element.removeAttribute("dots");
|
514
514
|
var splitRightElement = element.cloneNode(true);
|
515
|
-
splitRightElement.setAttribute("id",
|
515
|
+
splitRightElement.setAttribute("id", random_1.uuidv4());
|
516
516
|
splitRightElement.setAttribute("dur", (Math.abs(1 / chunkDurRight)).toString());
|
517
517
|
var beforeElement = elementIdx === 0 ? targetLayer.firstChild : targetLayer.children.item(elementIdx);
|
518
518
|
targetLayer.insertBefore(splitRightElement, beforeElement);
|
@@ -524,10 +524,10 @@ function doShiftRight(arr, meterRatio, currentLayer) {
|
|
524
524
|
dottedElements.left.forEach(lel => currentLayer.appendChild(lel));
|
525
525
|
var beforeElement = elementIdx === 0 ? targetLayer.firstChild : targetLayer.children.item(elementIdx);
|
526
526
|
dottedElements.right.forEach(rel => {
|
527
|
-
rel.setAttribute("id",
|
527
|
+
rel.setAttribute("id", random_1.uuidv4());
|
528
528
|
if (rel.tagName === "chord") {
|
529
529
|
rel.querySelectorAll("note").forEach(rl => {
|
530
|
-
rl.setAttribute("id",
|
530
|
+
rl.setAttribute("id", random_1.uuidv4());
|
531
531
|
});
|
532
532
|
}
|
533
533
|
targetLayer.insertBefore(rel, beforeElement);
|
@@ -548,10 +548,10 @@ function createEmptyCopy(element) {
|
|
548
548
|
child.parentNode.removeChild(child);
|
549
549
|
});
|
550
550
|
//set new ids for everything
|
551
|
-
copy.setAttribute("id",
|
551
|
+
copy.setAttribute("id", random_1.uuidv4());
|
552
552
|
copy.setAttribute("n", (parseInt(element.getAttribute("n")) + 1).toString());
|
553
553
|
let allElements = copy.querySelectorAll("*");
|
554
|
-
allElements.forEach(e => e.setAttribute("id",
|
554
|
+
allElements.forEach(e => e.setAttribute("id", random_1.uuidv4()));
|
555
555
|
return copy;
|
556
556
|
}
|
557
557
|
function connectNotes(left, right, connectionShape) {
|
@@ -579,7 +579,7 @@ function connectNotes(left, right, connectionShape) {
|
|
579
579
|
var tieElement = currentMEI.createElementNS(constants_1.constants._MEINS_, connectionShape);
|
580
580
|
tieElement.setAttribute("startid", "#" + left.id);
|
581
581
|
tieElement.setAttribute("endid", "#" + right.id);
|
582
|
-
tieElement.setAttribute("id",
|
582
|
+
tieElement.setAttribute("id", random_1.uuidv4());
|
583
583
|
currentMEI.getElementById(left.id).closest("measure").append(tieElement);
|
584
584
|
}
|
585
585
|
}
|
@@ -649,7 +649,7 @@ function doShiftLeft(arr, meterRatio) {
|
|
649
649
|
if (Number.isInteger(1 / chunkDurLeft) && Number.isInteger(1 / chunkDurRight)) {
|
650
650
|
element.removeAttribute("dots");
|
651
651
|
var splitLeftElement = element.cloneNode(true);
|
652
|
-
splitLeftElement.setAttribute("id",
|
652
|
+
splitLeftElement.setAttribute("id", random_1.uuidv4());
|
653
653
|
splitLeftElement.setAttribute("dur", (Math.abs(1 / chunkDurLeft)).toString());
|
654
654
|
targetLayer.appendChild(splitLeftElement);
|
655
655
|
//change already existing element
|
@@ -658,10 +658,10 @@ function doShiftLeft(arr, meterRatio) {
|
|
658
658
|
else {
|
659
659
|
var elements = splitDottedNote(element, chunkDurLeft, chunkDurRight);
|
660
660
|
elements.left.forEach(lel => {
|
661
|
-
lel.setAttribute("id",
|
661
|
+
lel.setAttribute("id", random_1.uuidv4());
|
662
662
|
if (lel.tagName === "chord") {
|
663
663
|
lel.querySelectorAll("note").forEach(ll => {
|
664
|
-
ll.setAttribute("id",
|
664
|
+
ll.setAttribute("id", random_1.uuidv4());
|
665
665
|
});
|
666
666
|
}
|
667
667
|
targetLayer.appendChild(lel);
|
@@ -1397,7 +1397,7 @@ function reorganizeBeams(currentMEI) {
|
|
1397
1397
|
}
|
1398
1398
|
else { // else make new beam
|
1399
1399
|
var newBeam = currentMEI.createElementNS(constants_1.constants._MEINS_, "beam");
|
1400
|
-
newBeam.setAttribute("id",
|
1400
|
+
newBeam.setAttribute("id", random_1.uuidv4());
|
1401
1401
|
n.parentElement.insertBefore(newBeam, n);
|
1402
1402
|
newBeam.append(n);
|
1403
1403
|
}
|
@@ -1554,10 +1554,10 @@ function addMeasure(currentMEI) {
|
|
1554
1554
|
m.setAttribute("n", i.toString());
|
1555
1555
|
i++;
|
1556
1556
|
});
|
1557
|
-
newMeasure.setAttribute("id",
|
1557
|
+
newMeasure.setAttribute("id", random_1.uuidv4());
|
1558
1558
|
newMeasure.querySelectorAll("*").forEach(el => {
|
1559
1559
|
if (el.id === null || el.id === "") {
|
1560
|
-
el.setAttribute("id",
|
1560
|
+
el.setAttribute("id", random_1.uuidv4());
|
1561
1561
|
}
|
1562
1562
|
});
|
1563
1563
|
cleanUp(currentMEI);
|
@@ -1708,7 +1708,7 @@ function createTuplet(meiElements, currentMEI) {
|
|
1708
1708
|
if (ratio < 1) {
|
1709
1709
|
if (durRest > 0) {
|
1710
1710
|
var rest = currentMEI.createElement("rest");
|
1711
|
-
rest.setAttribute("id",
|
1711
|
+
rest.setAttribute("id", random_1.uuidv4());
|
1712
1712
|
rest.setAttribute("dur", durRest.toString());
|
1713
1713
|
if (dotsRest > 0) {
|
1714
1714
|
rest.setAttribute("dots", dotsRest.toString());
|
@@ -1740,7 +1740,7 @@ function paste(ids, pastePosition, currentMEI) {
|
|
1740
1740
|
meiElements[num] = new Array();
|
1741
1741
|
}
|
1742
1742
|
var cel = el.cloneNode(true);
|
1743
|
-
cel.setAttribute("id",
|
1743
|
+
cel.setAttribute("id", random_1.uuidv4());
|
1744
1744
|
meiElements[num].push(cel);
|
1745
1745
|
}
|
1746
1746
|
}
|
@@ -1853,7 +1853,7 @@ function insertClef(target, newClef, currentMEI) {
|
|
1853
1853
|
}
|
1854
1854
|
var disPlace = newClef.includes("OctDown") ? "below" : newClef.includes("OctUp") ? "above" : null;
|
1855
1855
|
var clefElement = currentMEI.createElement("clef");
|
1856
|
-
clefElement.setAttribute("id",
|
1856
|
+
clefElement.setAttribute("id", random_1.uuidv4());
|
1857
1857
|
clefElement.setAttribute("shape", shape);
|
1858
1858
|
clefElement.setAttribute("line", line);
|
1859
1859
|
if (disPlace) {
|
@@ -2054,7 +2054,7 @@ exports.setArticulation = setArticulation;
|
|
2054
2054
|
//PRIVATE
|
2055
2055
|
function convertToNewNote(element) {
|
2056
2056
|
var newNote = {
|
2057
|
-
id:
|
2057
|
+
id: random_1.uuidv4(),
|
2058
2058
|
pname: element.getAttribute("pname"),
|
2059
2059
|
dur: element.getAttribute("dur"),
|
2060
2060
|
dots: element.getAttribute("dots"),
|
@@ -2091,7 +2091,7 @@ function convertToNewChord(element) {
|
|
2091
2091
|
return convertToNewNote(n);
|
2092
2092
|
});
|
2093
2093
|
var newChord = {
|
2094
|
-
id:
|
2094
|
+
id: random_1.uuidv4(),
|
2095
2095
|
dur: element.getAttribute("dur"),
|
2096
2096
|
dots: element.getAttribute("dots"),
|
2097
2097
|
noteElements: newNotes
|
@@ -2103,6 +2103,6 @@ function createNewRestElement(dur, dots = undefined) {
|
|
2103
2103
|
newElem.setAttribute("dur", dur.toString());
|
2104
2104
|
if (dots != undefined)
|
2105
2105
|
newElem.setAttribute("dots", dots.toString());
|
2106
|
-
newElem.setAttribute("id",
|
2106
|
+
newElem.setAttribute("id", random_1.uuidv4());
|
2107
2107
|
return newElem;
|
2108
2108
|
}
|
@@ -169,7 +169,7 @@ class Mouse2SVG {
|
|
169
169
|
const clefDisplacement = this.measureMatrix.get(idxParentMeasure, idxStaff).clefdisplacement;
|
170
170
|
Array.from(g).forEach((staffLine, idx) => {
|
171
171
|
if (staffLine.id === "") {
|
172
|
-
staffLine.id =
|
172
|
+
staffLine.id = random_1.uuidv4();
|
173
173
|
}
|
174
174
|
staffLine.classList.add("staffLine");
|
175
175
|
staffLine.classList.add("Clef" + clefShape + clefline + clefDisplacement);
|
@@ -600,7 +600,7 @@ class Mouse2SVG {
|
|
600
600
|
}
|
601
601
|
var artic = mappings_1.articButtonToAttr.get((_l = this.container.querySelector("#articGroup > .selected")) === null || _l === void 0 ? void 0 : _l.id);
|
602
602
|
var newNote = {
|
603
|
-
id:
|
603
|
+
id: random_1.uuidv4(),
|
604
604
|
pname: pname,
|
605
605
|
dur: this.getDurationNewNote(),
|
606
606
|
dots: this.getDotsNewNote(),
|
@@ -8,7 +8,7 @@ const buttonStyleDarkOutline = "btn btn-outline-dark btn-md";
|
|
8
8
|
function createColorPicker(id, onColorChange) {
|
9
9
|
const domNode = document.createElement("div");
|
10
10
|
domNode.setAttribute("id", id);
|
11
|
-
const root =
|
11
|
+
const root = client_1.createRoot(domNode);
|
12
12
|
root.render(React.createElement(ColorPickerWrapper, { onColorChange: onColorChange }));
|
13
13
|
return domNode;
|
14
14
|
}
|
@@ -336,7 +336,7 @@ class SVGEditor {
|
|
336
336
|
var barLine = measureSVG.querySelector(".barLine");
|
337
337
|
var coordinates = coords.getDOMMatrixCoordinates(barLine, barLine.closest("g"));
|
338
338
|
var textGroup = document.createElementNS(constants_1.constants._SVGNS_, "g");
|
339
|
-
textGroup.setAttribute("id",
|
339
|
+
textGroup.setAttribute("id", random_1.uuidv4());
|
340
340
|
textGroup.setAttribute("targetId", barLine.id);
|
341
341
|
var text = document.createElementNS(constants_1.constants._SVGNS_, "svg");
|
342
342
|
var textForeignObject = document.createElementNS(constants_1.constants._SVGNS_, "foreignObject");
|
@@ -419,7 +419,7 @@ class SVGEditor {
|
|
419
419
|
else {
|
420
420
|
Array.from(element.querySelectorAll("*")).forEach(el => {
|
421
421
|
if (el.id === "") {
|
422
|
-
el.setAttribute("id",
|
422
|
+
el.setAttribute("id", random_1.uuidv4());
|
423
423
|
}
|
424
424
|
});
|
425
425
|
}
|