vibe-editor 0.0.3 → 0.0.5
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 +65 -61
- package/src/scripts/js/Core.js +32 -13
- package/src/scripts/js/entry.js +6 -5
- package/src/scripts/js/gui/Annotations.js +28 -13
- package/src/scripts/js/gui/ScoreManipulator.js +13 -11
- package/src/scripts/js/gui/Tabbar.js +14 -5
- package/src/scripts/js/gui/Toolbar.js +1 -1
- package/src/scripts/js/handlers/AnnotationChangeHandler.js +16 -4
- package/src/scripts/js/handlers/CustomAnnotationShapeDrawer.js +2 -2
- package/src/scripts/js/handlers/InsertModeHandler.js +7 -7
- 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/PhantomElementHandler.js +3 -10
- package/src/scripts/js/handlers/{SideBarHandler.js → SidebarHandler.js} +1 -1
- package/src/scripts/js/handlers/TooltipHandler.js +1 -1
- 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/{assets → scripts/assets}/mei_template.js +2 -2
- 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/{gui → scripts/gui}/HarmonyLabel.js +1 -1
- 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 → scripts/gui}/TempoLabel.js +1 -1
- 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 +168 -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/{utils → scripts/utils}/ReactWrapper.js +1 -1
- 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} +35 -21
- package/src/scripts/js/scripts/utils/coordinates.js +54 -0
- package/src/scripts/js/utils/MEIOperations.js +22 -22
- package/src/scripts/js/utils/Mouse2SVG.js +13 -6
- package/src/scripts/js/utils/SVGEditor.js +2 -2
- package/src/scripts/js/utils/VerovioWrapper.js +4 -4
- package/src/scripts/js/utils/coordinates.js +26 -2
- 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/styles/vibe.css +0 -785
- /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}/Label.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}/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,11 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Mouse2SVG = void 0;
|
4
|
-
const constants_1 = require("../constants");
|
5
4
|
const random_1 = require("./random");
|
6
5
|
const mappings_1 = require("./mappings");
|
7
6
|
const MeasureMatrix_1 = require("../datastructures/MeasureMatrix");
|
8
|
-
const meiOperation = require("
|
7
|
+
const meiOperation = require("./MEIOperations");
|
9
8
|
const coordinates = require("./coordinates");
|
10
9
|
const cq = require("./convenienceQueries");
|
11
10
|
class Mouse2SVG {
|
@@ -31,7 +30,7 @@ class Mouse2SVG {
|
|
31
30
|
var enteredFlag = "lastEntered";
|
32
31
|
var activeContainerFlag = "activeContainer";
|
33
32
|
this.container.addEventListener("mouseenter", function (e) {
|
34
|
-
Array.from(document.getElementsByClassName("
|
33
|
+
Array.from(document.getElementsByClassName("vibe-container")).forEach(ac => {
|
35
34
|
if (ac === that.container) {
|
36
35
|
if (!that.container.classList.contains(activeContainerFlag)) {
|
37
36
|
that.container.classList.add(activeContainerFlag);
|
@@ -43,7 +42,7 @@ class Mouse2SVG {
|
|
43
42
|
});
|
44
43
|
});
|
45
44
|
this.container.addEventListener("mouseleave", function (e) {
|
46
|
-
Array.from(document.getElementsByClassName("
|
45
|
+
Array.from(document.getElementsByClassName("vibe-container")).forEach(ac => {
|
47
46
|
if (ac === that.container) {
|
48
47
|
ac.classList.remove(activeContainerFlag);
|
49
48
|
}
|
@@ -94,7 +93,8 @@ class Mouse2SVG {
|
|
94
93
|
}
|
95
94
|
});
|
96
95
|
});
|
97
|
-
this.interactionOverlay.querySelectorAll(".layer").forEach(layer => {
|
96
|
+
//this.interactionOverlay.querySelectorAll(".layer.activeLayer").forEach(layer => {
|
97
|
+
this.container.querySelectorAll(".layer.activeLayer").forEach(layer => {
|
98
98
|
layer.addEventListener(mouseEventName, function (e) {
|
99
99
|
e.preventDefault();
|
100
100
|
var target = e.target;
|
@@ -105,6 +105,7 @@ class Mouse2SVG {
|
|
105
105
|
});
|
106
106
|
that.lastLayerMouseEnter.classList.add(enteredFlag);
|
107
107
|
}
|
108
|
+
console.log(that.lastLayerMouseEnter);
|
108
109
|
});
|
109
110
|
});
|
110
111
|
return this;
|
@@ -155,32 +156,69 @@ class Mouse2SVG {
|
|
155
156
|
};
|
156
157
|
this.noteBBoxes.push(bb);
|
157
158
|
});
|
158
|
-
// this.measureMatrix.populateFromSVG(document.querySelector(c._vrvSVGID_WITH_IDSELECTOR_));
|
159
159
|
this.measureMatrix.populateFromMEI(this.currentMEI);
|
160
|
-
var staves = cq.getVrvSVG(this.containerId).querySelectorAll(
|
160
|
+
var staves = this.currentMEI.querySelectorAll("staff"); //cq.getVrvSVG(this.containerId).querySelectorAll(".staff")
|
161
161
|
Array.from(staves).forEach(element => {
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
162
|
+
const g = cq.getVrvSVG(this.containerId).querySelectorAll("#" + element.id + " > path");
|
163
|
+
const staff = element;
|
164
|
+
const idxStaff = parseInt(element.getAttribute("n")) - 1;
|
165
|
+
const closestMeasure = element.closest("measure");
|
166
|
+
const idxParentMeasure = parseInt(closestMeasure.getAttribute("n")) - 1;
|
167
|
+
const clefShape = this.measureMatrix.get(idxParentMeasure, idxStaff).clef;
|
168
|
+
const clefline = this.measureMatrix.get(idxParentMeasure, idxStaff).clefline;
|
169
|
+
const clefDisplacement = this.measureMatrix.get(idxParentMeasure, idxStaff).clefdisplacement;
|
168
170
|
Array.from(g).forEach((staffLine, idx) => {
|
169
171
|
if (staffLine.id === "") {
|
170
172
|
staffLine.id = random_1.uuidv4();
|
171
173
|
}
|
172
174
|
staffLine.classList.add("staffLine");
|
173
|
-
staffLine.classList.add("Clef" + clefShape);
|
175
|
+
staffLine.classList.add("Clef" + clefShape + clefline + clefDisplacement);
|
174
176
|
var map = null;
|
175
177
|
switch (clefShape) {
|
176
178
|
case "G":
|
177
|
-
|
179
|
+
switch (clefDisplacement) {
|
180
|
+
case "8below":
|
181
|
+
map = mappings_1.idxNoteMapGClefOctDown;
|
182
|
+
break;
|
183
|
+
case "8above":
|
184
|
+
map = mappings_1.idxNoteMapGClefOctUp;
|
185
|
+
break;
|
186
|
+
case null:
|
187
|
+
map = mappings_1.idxNoteMapGClef;
|
188
|
+
break;
|
189
|
+
}
|
178
190
|
break;
|
179
191
|
case "F":
|
180
|
-
|
192
|
+
switch (clefDisplacement) {
|
193
|
+
case "8below":
|
194
|
+
map = mappings_1.idxNoteMapFClefOctDown;
|
195
|
+
break;
|
196
|
+
case "8above":
|
197
|
+
map = mappings_1.idxNoteMapFClefOctUp;
|
198
|
+
break;
|
199
|
+
case null:
|
200
|
+
map = mappings_1.idxNoteMapFClef;
|
201
|
+
break;
|
202
|
+
}
|
181
203
|
break;
|
182
204
|
case "C":
|
183
|
-
|
205
|
+
switch (clefline) {
|
206
|
+
case "1":
|
207
|
+
map = mappings_1.idxNoteMapCClefSoprano;
|
208
|
+
break;
|
209
|
+
case "2":
|
210
|
+
map = mappings_1.idxNoteMapCClefMezzo;
|
211
|
+
break;
|
212
|
+
case "3":
|
213
|
+
map = mappings_1.idxNoteMapCClefAlto;
|
214
|
+
break;
|
215
|
+
case "4":
|
216
|
+
map = mappings_1.idxNoteMapCClefTenor;
|
217
|
+
break;
|
218
|
+
case "5":
|
219
|
+
map = mappings_1.idxNoteMapCClefBariton;
|
220
|
+
break;
|
221
|
+
}
|
184
222
|
break;
|
185
223
|
default:
|
186
224
|
console.error("No Clef found");
|
@@ -188,8 +226,7 @@ class Mouse2SVG {
|
|
188
226
|
}
|
189
227
|
staffLine.classList.add(map.get(idx * 2));
|
190
228
|
staffLine.classList.add("Clef" + clefShape);
|
191
|
-
|
192
|
-
var relpt = coordinates.getDOMMatrixCoordinates(staffLine, staffLine.closest("svg")); //this.vrvSVG)
|
229
|
+
var relpt = coordinates.getDOMMatrixCoordinates(staffLine, cq.getInteractOverlay(this.containerId)); //this.vrvSVG)
|
193
230
|
let bb = {
|
194
231
|
id: staffLine.parentElement.id,
|
195
232
|
y: relpt.y,
|
@@ -232,11 +269,11 @@ class Mouse2SVG {
|
|
232
269
|
* 2. Check position between staves
|
233
270
|
* 3. update
|
234
271
|
*
|
235
|
-
* @param x
|
236
|
-
* @param y
|
272
|
+
* @param x client Coordinate
|
273
|
+
* @param y client Coordinate
|
237
274
|
*/
|
238
275
|
defineNote(x, y, options) {
|
239
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
276
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
240
277
|
let staffIsEmpty = true;
|
241
278
|
let isLeftOfNote;
|
242
279
|
//let isRightOfNote: Boolean
|
@@ -264,20 +301,26 @@ class Mouse2SVG {
|
|
264
301
|
staffIsEmpty = false;
|
265
302
|
}
|
266
303
|
});
|
267
|
-
var currentStaffClef
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
304
|
+
// var currentStaffClef: string
|
305
|
+
// var entries = this.getElementinVrvSVG(this.lastStaffMouseEnter?.getAttribute("refId"))?.querySelector(".staffLine")?.classList?.entries()
|
306
|
+
// if([null, undefined].some(n => entries == n)) return
|
307
|
+
// for (const [key, value] of entries) {
|
308
|
+
// if (value.includes("Clef")) {
|
309
|
+
// currentStaffClef = value
|
310
|
+
// break;
|
311
|
+
// }
|
312
|
+
// }
|
313
|
+
const col = (_g = this.getElementinVrvSVG((_f = this.lastStaffMouseEnter) === null || _f === void 0 ? void 0 : _f.getAttribute("refId"))) === null || _g === void 0 ? void 0 : _g.getAttribute("n");
|
314
|
+
const row = (_j = this.getElementinVrvSVG((_h = this.lastStaffMouseEnter) === null || _h === void 0 ? void 0 : _h.getAttribute("refId"))) === null || _j === void 0 ? void 0 : _j.closest(".measure").getAttribute("n");
|
315
|
+
const currentStaff = this.measureMatrix.get(row, col);
|
274
316
|
// Define relative position for click insert
|
275
317
|
// position should also consider right border of bounding box. Position should be
|
276
318
|
if (!staffIsEmpty) {
|
277
319
|
let nbb = [];
|
278
320
|
this.noteBBoxes.forEach(bb => {
|
279
321
|
var _a;
|
280
|
-
|
322
|
+
//console.log(bb.parentStaff.id === this.lastStaffMouseEnter?.getAttribute("refId"), Array.from(this.container.querySelectorAll(".activeLayer")).some(l => bb.parentLayer.id === l.id), Array.from(this.container.querySelectorAll(".activeLayer")), bb.parentLayer)
|
323
|
+
if (bb.parentStaff.id === ((_a = this.lastStaffMouseEnter) === null || _a === void 0 ? void 0 : _a.getAttribute("refId")) && Array.from(this.container.querySelectorAll(".activeLayer")).some(l => bb.parentLayer.id === l.id)) {
|
281
324
|
nbb.push(bb);
|
282
325
|
}
|
283
326
|
});
|
@@ -311,21 +354,93 @@ class Mouse2SVG {
|
|
311
354
|
let lineArr = aboveSystem ? this.phantomStaffLinesAbove : this.phantomStaffLinesBelow;
|
312
355
|
let aboveMap;
|
313
356
|
let belowMap;
|
314
|
-
switch (currentStaffClef) {
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
357
|
+
// switch (currentStaffClef) {
|
358
|
+
// case "ClefG2":
|
359
|
+
// aboveMap = idxNotePhantomMapAboveG
|
360
|
+
// belowMap = idxNotePhantomMapBelowG
|
361
|
+
// break;
|
362
|
+
// case "ClefF4":
|
363
|
+
// aboveMap = idxNotePhantomMapAboveF
|
364
|
+
// belowMap = idxNotePhantomMapBelowF
|
365
|
+
// break;
|
366
|
+
// case "ClefC1":
|
367
|
+
// aboveMap = idxNotePhantomMapAboveCSoprano
|
368
|
+
// belowMap = idxNotePhantomMapBelowCSoprano
|
369
|
+
// break;
|
370
|
+
// case "ClefC2":
|
371
|
+
// aboveMap = idxNotePhantomMapAboveCMezzo
|
372
|
+
// belowMap = idxNotePhantomMapBelowCMezzo
|
373
|
+
// break;
|
374
|
+
// case "ClefC3":
|
375
|
+
// aboveMap = idxNotePhantomMapAboveCAlto
|
376
|
+
// belowMap = idxNotePhantomMapBelowCAlto
|
377
|
+
// break;
|
378
|
+
// case "ClefC4":
|
379
|
+
// aboveMap = idxNotePhantomMapAboveCTenor
|
380
|
+
// belowMap = idxNotePhantomMapBelowCTenor
|
381
|
+
// break;
|
382
|
+
// case "ClefC5":
|
383
|
+
// aboveMap = idxNotePhantomMapAboveCBariton
|
384
|
+
// belowMap = idxNotePhantomMapBelowCBariton
|
385
|
+
// break;
|
386
|
+
// default:
|
387
|
+
// console.log("NO CLEF FOUND")
|
388
|
+
// }
|
389
|
+
if (currentStaff.clef === "G") {
|
390
|
+
switch (currentStaff.clefdisplacement) {
|
391
|
+
case null:
|
392
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveG;
|
393
|
+
belowMap = mappings_1.idxNotePhantomMapBelowG;
|
394
|
+
break;
|
395
|
+
case "8above":
|
396
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveGOctUp;
|
397
|
+
belowMap = mappings_1.idxNotePhantomMapBelowGOctUp;
|
398
|
+
break;
|
399
|
+
case "8below":
|
400
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveGOctDown;
|
401
|
+
belowMap = mappings_1.idxNotePhantomMapBelowGOctDown;
|
402
|
+
break;
|
403
|
+
}
|
404
|
+
}
|
405
|
+
else if (currentStaff.clef === "F") {
|
406
|
+
switch (currentStaff.clefdisplacement) {
|
407
|
+
case null:
|
408
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveF;
|
409
|
+
belowMap = mappings_1.idxNotePhantomMapBelowF;
|
410
|
+
break;
|
411
|
+
case "8above":
|
412
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveFOctUp;
|
413
|
+
belowMap = mappings_1.idxNotePhantomMapBelowFOctUp;
|
414
|
+
break;
|
415
|
+
case "8below":
|
416
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveFOctDown;
|
417
|
+
belowMap = mappings_1.idxNotePhantomMapBelowFOctDown;
|
418
|
+
break;
|
419
|
+
}
|
420
|
+
}
|
421
|
+
else if (currentStaff.clef === "C") {
|
422
|
+
switch (currentStaff.clefline) {
|
423
|
+
case "1":
|
424
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveCSoprano;
|
425
|
+
belowMap = mappings_1.idxNotePhantomMapBelowCSoprano;
|
426
|
+
break;
|
427
|
+
case "2":
|
428
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveCMezzo;
|
429
|
+
belowMap = mappings_1.idxNotePhantomMapBelowCMezzo;
|
430
|
+
break;
|
431
|
+
case "3":
|
432
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveCAlto;
|
433
|
+
belowMap = mappings_1.idxNotePhantomMapBelowCAlto;
|
434
|
+
break;
|
435
|
+
case "4":
|
436
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveCTenor;
|
437
|
+
belowMap = mappings_1.idxNotePhantomMapBelowCTenor;
|
438
|
+
break;
|
439
|
+
case "5":
|
440
|
+
aboveMap = mappings_1.idxNotePhantomMapAboveCBariton;
|
441
|
+
belowMap = mappings_1.idxNotePhantomMapBelowCBariton;
|
442
|
+
break;
|
443
|
+
}
|
329
444
|
}
|
330
445
|
let map = aboveSystem ? aboveMap : belowMap;
|
331
446
|
let mappingidx = 0;
|
@@ -398,12 +513,38 @@ class Mouse2SVG {
|
|
398
513
|
let map = null;
|
399
514
|
if (currentNearestStaffLine.classList.contains("ClefG")) {
|
400
515
|
map = mappings_1.idxNoteMapGClef;
|
516
|
+
if (currentNearestStaffLine.classList.contains("ClefG28above")) {
|
517
|
+
map = mappings_1.idxNoteMapGClefOctUp;
|
518
|
+
}
|
519
|
+
else if (currentNearestStaffLine.classList.contains("ClefG28below")) {
|
520
|
+
map = mappings_1.idxNoteMapGClefOctDown;
|
521
|
+
}
|
401
522
|
}
|
402
523
|
else if (currentNearestStaffLine.classList.contains("ClefF")) {
|
403
524
|
map = mappings_1.idxNoteMapFClef;
|
525
|
+
if (currentNearestStaffLine.classList.contains("ClefF48above")) {
|
526
|
+
map = mappings_1.idxNoteMapFClefOctUp;
|
527
|
+
}
|
528
|
+
else if (currentNearestStaffLine.classList.contains("ClefF48below")) {
|
529
|
+
map = mappings_1.idxNoteMapFClefOctDown;
|
530
|
+
}
|
404
531
|
}
|
405
532
|
else if (currentNearestStaffLine.classList.contains("ClefC")) {
|
406
|
-
|
533
|
+
if (Array.from(currentNearestStaffLine.classList).some(c => c.includes("ClefC1"))) {
|
534
|
+
map = mappings_1.idxNoteMapCClefSoprano;
|
535
|
+
}
|
536
|
+
else if (Array.from(currentNearestStaffLine.classList).some(c => c.includes("ClefC2"))) {
|
537
|
+
map = mappings_1.idxNoteMapCClefMezzo;
|
538
|
+
}
|
539
|
+
else if (Array.from(currentNearestStaffLine.classList).some(c => c.includes("ClefC3"))) {
|
540
|
+
map = mappings_1.idxNoteMapCClefAlto;
|
541
|
+
}
|
542
|
+
else if (Array.from(currentNearestStaffLine.classList).some(c => c.includes("ClefC4"))) {
|
543
|
+
map = mappings_1.idxNoteMapCClefTenor;
|
544
|
+
}
|
545
|
+
else if (Array.from(currentNearestStaffLine.classList).some(c => c.includes("ClefC5"))) {
|
546
|
+
map = mappings_1.idxNoteMapCClefBariton;
|
547
|
+
}
|
407
548
|
}
|
408
549
|
else {
|
409
550
|
throw new Error("No Note to Clef Mapping found");
|
@@ -419,7 +560,7 @@ class Mouse2SVG {
|
|
419
560
|
try {
|
420
561
|
pitch = cq.getInteractOverlay(this.containerId).querySelector("#" + options.staffLineId).getAttribute("class").split(" ");
|
421
562
|
}
|
422
|
-
catch (
|
563
|
+
catch (_r) {
|
423
564
|
return;
|
424
565
|
}
|
425
566
|
let p = pitch.filter(function (obj) {
|
@@ -437,7 +578,7 @@ class Mouse2SVG {
|
|
437
578
|
}
|
438
579
|
//get relevant staffinfo
|
439
580
|
//var closestStaff = this.currentMEI.getElementById(currentNearestNote.id).closest("staff")
|
440
|
-
var closestStaff = this.currentMEI.getElementById((
|
581
|
+
var closestStaff = this.currentMEI.getElementById((_k = this.lastStaffMouseEnter) === null || _k === void 0 ? void 0 : _k.getAttribute("refId"));
|
441
582
|
var closestMeasure = closestStaff.closest("measure");
|
442
583
|
var closestStaffIdx = parseInt(closestStaff.getAttribute("n")) - 1;
|
443
584
|
var closestMeasureIdx = parseInt(closestMeasure.getAttribute("n")) - 1;
|
@@ -448,7 +589,7 @@ class Mouse2SVG {
|
|
448
589
|
var keysig = this.measureMatrix.get(closestMeasureIdx, closestStaffIdx).keysig;
|
449
590
|
var accid;
|
450
591
|
if (this.container.querySelector(".alterBtn.selected") !== null) {
|
451
|
-
accid = mappings_1.
|
592
|
+
accid = mappings_1.accidButtonToAttr.get(this.container.querySelector(".alterBtn.selected").id);
|
452
593
|
}
|
453
594
|
else if (keysig != undefined) {
|
454
595
|
accid = mappings_1.keysigToNotes.get(keysig);
|
@@ -457,6 +598,7 @@ class Mouse2SVG {
|
|
457
598
|
accid = keysig.charAt(1);
|
458
599
|
}
|
459
600
|
}
|
601
|
+
var artic = mappings_1.articButtonToAttr.get((_l = this.container.querySelector("#articGroup > .selected")) === null || _l === void 0 ? void 0 : _l.id);
|
460
602
|
var newNote = {
|
461
603
|
id: random_1.uuidv4(),
|
462
604
|
pname: pname,
|
@@ -465,11 +607,13 @@ class Mouse2SVG {
|
|
465
607
|
oct: oct,
|
466
608
|
keysig: keysig,
|
467
609
|
accid: accid,
|
610
|
+
artic: artic,
|
468
611
|
nearestNoteId: nearestNoteId,
|
469
612
|
relPosX: leftRightPos,
|
470
|
-
staffId: (
|
613
|
+
staffId: (_m = this.lastStaffMouseEnter) === null || _m === void 0 ? void 0 : _m.getAttribute("refId"),
|
614
|
+
layerId: (_p = this.container.querySelector(`#${(_o = this.lastStaffMouseEnter) === null || _o === void 0 ? void 0 : _o.getAttribute("refId")} .activeLayer`)) === null || _p === void 0 ? void 0 : _p.id,
|
471
615
|
chordElement: options.targetChord,
|
472
|
-
rest: this.container.querySelector("#pauseNote").classList.contains("selected")
|
616
|
+
rest: (_q = this.container.querySelector("#pauseNote")) === null || _q === void 0 ? void 0 : _q.classList.contains("selected")
|
473
617
|
};
|
474
618
|
this.newNote = newNote;
|
475
619
|
}
|
@@ -482,13 +626,20 @@ class Mouse2SVG {
|
|
482
626
|
* @param orientation only consider elements which are left or right of given coordinates
|
483
627
|
* @returns
|
484
628
|
*/
|
485
|
-
findScoreTarget(posX, posY, checkStaff = true, orientation =
|
629
|
+
findScoreTarget(posX, posY, checkStaff = true, orientation = null, blackList = null) {
|
630
|
+
if (!orientation)
|
631
|
+
orientation = { left: true, right: true };
|
486
632
|
var notes = this.getNoteBBoxes();
|
487
633
|
var nextNote;
|
488
634
|
var tempDist = Math.pow(10, 10);
|
489
635
|
var i = 0;
|
490
636
|
notes.forEach(n => {
|
491
637
|
var _a, _b, _c, _d;
|
638
|
+
if (blackList) {
|
639
|
+
var blackListFilter = Array.from(this.getElementinVrvSVG(n.id).classList).filter(element => blackList.includes(element));
|
640
|
+
if (blackListFilter.length > 0)
|
641
|
+
return;
|
642
|
+
}
|
492
643
|
var x;
|
493
644
|
var y;
|
494
645
|
if (((_a = this.getElementinVrvSVG(n.id)) === null || _a === void 0 ? void 0 : _a.closest(".chord")) && navigator.userAgent.toLowerCase().indexOf("firefox") > -1) { // special rule for firefox browsers
|
@@ -500,19 +651,22 @@ class Mouse2SVG {
|
|
500
651
|
y = n.y;
|
501
652
|
}
|
502
653
|
//filter for left and right elements
|
654
|
+
if (this.vrvSVG.querySelector("#" + n.id) === null)
|
655
|
+
return;
|
503
656
|
if (!this.vrvSVG.querySelector("#" + n.id).classList.contains("mRest")) { //mRest are excluded from this rule
|
504
|
-
if (orientation.left
|
657
|
+
if (!orientation.left) {
|
505
658
|
if (x < posX)
|
506
659
|
return; //exclude left elements
|
507
660
|
}
|
508
|
-
else if (orientation.right
|
661
|
+
else if (!orientation.right) {
|
509
662
|
if (x > posX)
|
510
663
|
return; // exclude right elements
|
511
664
|
}
|
512
665
|
}
|
513
666
|
var dist = Math.abs(x - posX);
|
514
667
|
var staffCondition = n.parentStaff === this.getElementinVrvSVG((_d = this.lastStaffMouseEnter) === null || _d === void 0 ? void 0 : _d.getAttribute("refId"));
|
515
|
-
|
668
|
+
staffCondition && (staffCondition = Array.from(this.container.querySelectorAll(".activeLayer")).some(l => n.parentLayer === l));
|
669
|
+
if (!checkStaff) {
|
516
670
|
staffCondition = true;
|
517
671
|
dist = Math.sqrt(Math.abs(x - posX) ** 2 + Math.abs(y - posY) ** 2);
|
518
672
|
}
|
@@ -526,6 +680,17 @@ class Mouse2SVG {
|
|
526
680
|
});
|
527
681
|
return nextNote;
|
528
682
|
}
|
683
|
+
/**
|
684
|
+
* change to current VOice to interact with.
|
685
|
+
* createLayer if not does not exist
|
686
|
+
* @param staffN
|
687
|
+
* @param voiceN
|
688
|
+
*/
|
689
|
+
changeLayer(staffN, voiceN) {
|
690
|
+
if (!this.currentMEI.querySelector(`staff[n='${staffN}'] layer[n='${voiceN}']`)) {
|
691
|
+
meiOperation.addLayerForStaff(this.currentMEI, staffN, voiceN);
|
692
|
+
}
|
693
|
+
}
|
529
694
|
///// GETTER/ SETTER ///////
|
530
695
|
getLastMouseEnter() {
|
531
696
|
return { layer: this.lastLayerMouseEnter, staff: this.lastStaffMouseEnter, measure: this.lastMeasureMouseEnter, system: this.lastSystemMouseEnter };
|
@@ -581,7 +746,7 @@ class Mouse2SVG {
|
|
581
746
|
additionalElements = additionalElements.filter((v, i) => i > additionalElements.indexOf(newMeiElement));
|
582
747
|
//this.currentMEI = meiOperation.changeDuration(this.currentMEI, "reduce", additionalElements)
|
583
748
|
//additionalElements.unshift(oldMeiElement) // we need this information to determine the new duration of an element that has to be shortened
|
584
|
-
this.currentMEI = meiOperation.
|
749
|
+
this.currentMEI = meiOperation.changeDurationsInLayer(this.currentMEI, additionalElements, newMeiElement); //this.currentMEI = meiOperation.changeDuration(this.currentMEI, additionalElements)
|
585
750
|
//}
|
586
751
|
this.currentMEI.querySelectorAll(".changed").forEach(c => c.classList.remove("changed"));
|
587
752
|
//check if following events (notes, chords, rests) should be replaced
|
@@ -624,7 +789,7 @@ class Mouse2SVG {
|
|
624
789
|
additionalElements = additionalElements.filter((v, i) => i > additionalElements.indexOf(newMeiElement));
|
625
790
|
//this.currentMEI = meiOperation.changeDuration(this.currentMEI, "reduce", additionalElements)
|
626
791
|
//additionalElements.unshift(oldMeiElement) // we need this information to determine the new duration of an element that has to be shortened
|
627
|
-
this.currentMEI = meiOperation.
|
792
|
+
this.currentMEI = meiOperation.changeDurationsInLayer(this.currentMEI, additionalElements, newMeiElement, meiOperation.getAbsoluteRatio(newMeiElement) - meiOperation.getAbsoluteRatio(oldMeiElement)); //this.currentMEI = meiOperation.changeDuration(this.currentMEI, additionalElements)
|
628
793
|
//}
|
629
794
|
this.currentMEI.querySelectorAll(".changed").forEach(c => c.classList.remove("changed"));
|
630
795
|
if (meiOperation.elementIsOverfilling(meiElement, currMeiClone)) {
|
@@ -679,6 +844,9 @@ class Mouse2SVG {
|
|
679
844
|
return "4";
|
680
845
|
}
|
681
846
|
switch (selEl.id) {
|
847
|
+
case "breveNote":
|
848
|
+
dur = 0.5;
|
849
|
+
break;
|
682
850
|
case "fullNote":
|
683
851
|
dur = 1;
|
684
852
|
break;
|
@@ -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
|
}
|