vibe-editor 0.0.4 → 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 +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 +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/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/Mouse2SVG.js +11 -4
- 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/{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
package/package.json
CHANGED
@@ -1,63 +1,67 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
"
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
2
|
+
"name": "vibe-editor",
|
3
|
+
"version": "0.0.5",
|
4
|
+
"main": "src/scripts/js/scripts/VIBE.js",
|
5
|
+
"keywords": [],
|
6
|
+
"author": "Matthias Nowakowski",
|
7
|
+
"license": "MIT",
|
8
|
+
"browserslist": [
|
9
|
+
"since 2017-06"
|
10
|
+
],
|
11
|
+
"scripts": {
|
12
|
+
"build": "./node_modules/.bin/webpack --mode=development",
|
13
|
+
"watch": "./node_modules/.bin/webpack --watch"
|
14
|
+
},
|
15
|
+
"files": [
|
16
|
+
"src/images/*/*",
|
17
|
+
"src/scripts/js/*",
|
18
|
+
"src/fonts/*"
|
19
|
+
],
|
20
|
+
"dependencies": {
|
21
|
+
"@babel/plugin-transform-classes": "^7.16.7",
|
22
|
+
"@babel/preset-env": "^7.16.11",
|
23
|
+
"@popperjs/core": "^2.11.6",
|
24
|
+
"@tonejs/midi": "^2.0.28",
|
25
|
+
"@types/react": "^18.2.28",
|
26
|
+
"@types/react-dom": "^18.2.13",
|
27
|
+
"axios": "^1.4.0",
|
28
|
+
"babel": "^6.23.0",
|
29
|
+
"babel-loader": "^8.2.3",
|
30
|
+
"bootstrap": "^5.1.3",
|
31
|
+
"brotli-webpack-plugin": "^1.1.0",
|
32
|
+
"buffer": "^5.7.1",
|
33
|
+
"compression-webpack-plugin": "^9.2.0",
|
34
|
+
"css-loader": "^6.7.1",
|
35
|
+
"d3": "^5.11.0",
|
36
|
+
"esbuild": "0.17.14",
|
37
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
38
|
+
"file-loader": "^6.2.0",
|
39
|
+
"h5p-lib-controls": "^0.0.15",
|
40
|
+
"html-webpack-plugin": "^5.6.0",
|
41
|
+
"interactjs": "1.10.11",
|
42
|
+
"midi-player-js": "^2.0.16",
|
43
|
+
"mini-css-extract-plugin": "^2.6.0",
|
44
|
+
"node-sass": "^7.0.1",
|
45
|
+
"postcss-loader": "^6.2.1",
|
46
|
+
"react-color": "^2.19.3",
|
47
|
+
"react-dom": "^18.2.0",
|
48
|
+
"sass-loader": "^12.6.0",
|
49
|
+
"soundfont-player": "^0.12.0",
|
50
|
+
"style-loader": "^3.3.1",
|
51
|
+
"svg-url-loader": "^8.0.0",
|
52
|
+
"tone": "^14.7.77",
|
53
|
+
"ts-loader": "^9.5.1",
|
54
|
+
"typescript": "4.6.3",
|
55
|
+
"update": "^0.7.4",
|
56
|
+
"web-midi-api": "^2.2.5",
|
57
|
+
"webpack": "^5.88.2",
|
58
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
59
|
+
"webpack-cli": "^4.9.2"
|
60
|
+
},
|
61
|
+
"devDependencies": {
|
62
|
+
"@types/verovio": "^3.13.0",
|
63
|
+
"raw-loader": "^4.0.2",
|
64
|
+
"url-loader": "^4.1.1"
|
65
|
+
},
|
66
|
+
"description": "Current version in npm repo: "
|
63
67
|
}
|
package/src/scripts/js/Core.js
CHANGED
@@ -224,12 +224,18 @@ class Core {
|
|
224
224
|
pageElement.setAttribute("preserveAspectRatio", "xMinYMin meet");
|
225
225
|
var systemHeigth = pageElement.querySelector(".system").getBoundingClientRect().height;
|
226
226
|
systemHeigth += systemHeigth * 0.2;
|
227
|
-
that.verovioWrapper.setHeightValue(systemHeigth)
|
228
|
-
if
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
227
|
+
//that.verovioWrapper.setHeightValue(systemHeigth)
|
228
|
+
// if(!options){
|
229
|
+
// options = {}
|
230
|
+
// }
|
231
|
+
// options.widthFactor = (that.container as HTMLElement).clientWidth / screen.availWidth
|
232
|
+
// if (options?.widthFactor) {
|
233
|
+
// console.log("pageW before", that.verovioWrapper.getOptions().pageWidth)
|
234
|
+
// that.verovioWrapper.setWidthValue(
|
235
|
+
// parseFloat(that.verovioWrapper.getOptions().pageWidth) * options.widthFactor
|
236
|
+
// )
|
237
|
+
// console.log("pageW after", that.verovioWrapper.getOptions().pageWidth)
|
238
|
+
// }
|
233
239
|
resolve();
|
234
240
|
});
|
235
241
|
}
|
@@ -405,11 +411,24 @@ class Core {
|
|
405
411
|
this.containerId = container.id;
|
406
412
|
this.verovioWrapper = this.verovioWrapper || new VerovioWrapper_1.default();
|
407
413
|
var waitingFlag = "waiting";
|
408
|
-
// if (cq.getVrvSVG(this.containerId) !== null) {
|
409
|
-
// document.body.classList.add(waitingFlag)
|
410
|
-
// }
|
411
414
|
// svg has to be loaded into verovio anyway
|
412
415
|
this.sendDataToVerovio(data, isUrl);
|
416
|
+
this.interactionOverlay = cq.getInteractOverlay(this.containerId);
|
417
|
+
// get most right standing canvas in interactionOverlay
|
418
|
+
let rightMostElement = this.interactionOverlay;
|
419
|
+
let rightCoord = 0;
|
420
|
+
this.container.querySelectorAll("#interactionOverlay > *, #vrvSVG > svg > *").forEach(c => {
|
421
|
+
let bbox = c.getBoundingClientRect();
|
422
|
+
if (bbox.x + bbox.width > rightCoord) {
|
423
|
+
rightCoord = bbox.x + bbox.width;
|
424
|
+
rightMostElement = c;
|
425
|
+
}
|
426
|
+
});
|
427
|
+
var sizeRatio = ((this.container.getBoundingClientRect().width / this.interactionOverlay.getBoundingClientRect().width) + 2) * 100; //rightMostElement.getBoundingClientRect().width * 60
|
428
|
+
if (!sizeRatio || sizeRatio <= 0) {
|
429
|
+
sizeRatio = 100;
|
430
|
+
}
|
431
|
+
this.container.querySelector("#svgContainer").style.width = sizeRatio.toString() + "%";
|
413
432
|
document.getElementById(this.containerId).dispatchEvent(new Event("loadingStart"));
|
414
433
|
this.svgEditor.setContainerId(this.containerId);
|
415
434
|
this.svgEditor.cacheClasses().cacheScales().cacheStyles();
|
package/src/scripts/js/entry.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const VIBE_1 = require("./scripts/VIBE");
|
4
|
+
require("./styles/vibe.css");
|
5
|
+
const container = document.getElementById("vse-container1");
|
6
|
+
var vse = new VIBE_1.default(container, null, null);
|
@@ -150,6 +150,7 @@ class Annotations {
|
|
150
150
|
b.addEventListener("click", this.clickAnnotTextHandler);
|
151
151
|
});
|
152
152
|
harmonyButton === null || harmonyButton === void 0 ? void 0 : harmonyButton.addEventListener("click", this.clickHarmonyBtnHandler);
|
153
|
+
//window.addEventListener("resize", this.resizeHandler)
|
153
154
|
return this;
|
154
155
|
}
|
155
156
|
removeListeners() {
|
@@ -159,6 +160,7 @@ class Annotations {
|
|
159
160
|
b.removeEventListener("click", this.clickAnnotTextHandler);
|
160
161
|
});
|
161
162
|
harmonyButton === null || harmonyButton === void 0 ? void 0 : harmonyButton.removeEventListener("click", this.clickHarmonyBtnHandler);
|
163
|
+
//window.removeEventListener("resize", this.resizeHandler)
|
162
164
|
}
|
163
165
|
setTextListeners() {
|
164
166
|
// this.customAnnotationDrawer = new CustomAnnotationShapeDrawer(this.containerId)
|
@@ -290,7 +292,21 @@ class Annotations {
|
|
290
292
|
var pt = coordinates.transformToDOMMatrixCoordinates(e.clientX, e.clientY, cq.getInteractOverlay(this.containerId));
|
291
293
|
var posx = pt.x; //matrixTransform(rootMatrix).x //e.pageX - this.rootBBox.x - window.pageXOffset
|
292
294
|
var posy = pt.y; //matrixTransform(rootMatrix).y //e.pageY - this.rootBBox.y - window.pageYOffset
|
293
|
-
var
|
295
|
+
var staves = this.interactionOverlay.querySelectorAll(".staff");
|
296
|
+
var tempDist = Math.pow(10, 10);
|
297
|
+
var annotationTarget = this.m2s.findScoreTarget(posx, posy, false, null, ["mRest"]);
|
298
|
+
if (!annotationTarget) {
|
299
|
+
var annotationCoords;
|
300
|
+
staves.forEach(s => {
|
301
|
+
var coord = coordinates.getDOMMatrixCoordinates(s, this.interactionOverlay);
|
302
|
+
var dist = Math.sqrt(Math.abs(coord.x - posx) ** 2 + Math.abs(coord.y - posy) ** 2);
|
303
|
+
if (dist < tempDist) {
|
304
|
+
tempDist = dist;
|
305
|
+
annotationTarget = this.vrvSVG.querySelector("#" + s.getAttribute("refId"));
|
306
|
+
annotationCoords = coord;
|
307
|
+
}
|
308
|
+
});
|
309
|
+
}
|
294
310
|
var textGroup = document.createElementNS(constants_1.constants._SVGNS_, "g");
|
295
311
|
textGroup.setAttribute("id", random_1.uuidv4());
|
296
312
|
textGroup.setAttribute("targetId", annotationTarget.id);
|
@@ -318,21 +334,22 @@ class Annotations {
|
|
318
334
|
var foW = (50 + 2 * rectPadding + 50).toString();
|
319
335
|
textForeignObject.setAttribute("x", foX);
|
320
336
|
textForeignObject.setAttribute("y", foY);
|
321
|
-
textForeignObject.setAttribute("height", foH)
|
322
|
-
textForeignObject.setAttribute("width", foW)
|
337
|
+
// textForeignObject.style.height = foH + "px" //setAttribute("height", foH)
|
338
|
+
// textForeignObject.style.width = foW + "px" //setAttribute("width", foW)
|
323
339
|
if (isLinked) {
|
324
340
|
var line = document.createElementNS(constants_1.constants._SVGNS_, "line");
|
325
341
|
line.classList.add("annotLine");
|
342
|
+
const targetCoords = annotationCoords || annotationTarget;
|
326
343
|
const lX2 = textForeignObject.x.baseVal.valueAsString;
|
327
344
|
const lY2 = textForeignObject.y.baseVal.valueAsString;
|
328
|
-
const lX1 =
|
329
|
-
const lY1 =
|
345
|
+
const lX1 = targetCoords.x.toString();
|
346
|
+
const lY1 = targetCoords.y.toString();
|
330
347
|
line.setAttribute("x2", lX2);
|
331
348
|
line.setAttribute("y2", lY2);
|
332
349
|
line.setAttribute("x1", lX1);
|
333
350
|
line.setAttribute("y1", lY1);
|
334
|
-
const xDiff = parseFloat(lX1) - parseFloat(lX2)
|
335
|
-
const yDiff = parseFloat(lY1) - parseFloat(lY2)
|
351
|
+
const xDiff = parseFloat(lX2) - parseFloat(lX1); //parseFloat(lX1) - parseFloat(lX2)
|
352
|
+
const yDiff = parseFloat(lY2) - parseFloat(lY1); //parseFloat(lY1) - parseFloat(lY2)
|
336
353
|
line.setAttribute("x-diff", xDiff.toString());
|
337
354
|
line.setAttribute("y-diff", yDiff.toString());
|
338
355
|
line.classList.add("annotLine");
|
@@ -343,10 +360,8 @@ class Annotations {
|
|
343
360
|
var newAnnot = {
|
344
361
|
sourceID: textGroup.id,
|
345
362
|
targetID: annotationTarget.id,
|
346
|
-
|
347
|
-
|
348
|
-
// y: textGroup.getBoundingClientRect().y - annotationTarget.getBoundingClientRect().y
|
349
|
-
// }
|
363
|
+
originalWidth: "200",
|
364
|
+
originalHeight: "100",
|
350
365
|
};
|
351
366
|
this.annotations.push(newAnnot);
|
352
367
|
this.annotationCanvas.appendChild(textGroup);
|
@@ -438,7 +453,7 @@ class Annotations {
|
|
438
453
|
return;
|
439
454
|
var foreignObject = source.querySelector(".annotFO");
|
440
455
|
const targetBbox = target.getBoundingClientRect();
|
441
|
-
const targetPt = coordinates.transformToDOMMatrixCoordinates(targetBbox.x, targetBbox.y, cq.getInteractOverlay(this.containerId)
|
456
|
+
const targetPt = coordinates.transformToDOMMatrixCoordinates(targetBbox.x, targetBbox.y, cq.getInteractOverlay(this.containerId)); //.querySelector("#annotationCanvas"))
|
442
457
|
var line = source.querySelector("line");
|
443
458
|
const xSource = targetPt.x + parseFloat(line.getAttribute("x-diff"));
|
444
459
|
const ySource = targetPt.y + parseFloat(line.getAttribute("y-diff"));
|
@@ -121,7 +121,9 @@ class ScoreManipulator {
|
|
121
121
|
for (let i = 0; i < 4; i++) {
|
122
122
|
var btn = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
123
123
|
var btnRect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
124
|
-
var
|
124
|
+
var btnFO = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
|
125
|
+
var btnText = document.createElement("div");
|
126
|
+
btnFO.append(btnText);
|
125
127
|
btnText.textContent = (i + 1).toString();
|
126
128
|
btn.setAttribute("x", "3px");
|
127
129
|
btn.setAttribute("y", (yTop + btnHeight * i).toString());
|
@@ -133,10 +135,10 @@ class ScoreManipulator {
|
|
133
135
|
btn.setAttribute("btnN", (i + 1).toString());
|
134
136
|
btn.setAttribute("id", "voiceSelect-" + staff.getAttribute("n") + "-" + (i + 1).toString());
|
135
137
|
//btnText is relative to btn
|
136
|
-
|
137
|
-
btnText.
|
138
|
+
var fontSize = btnHeight;
|
139
|
+
btnText.style.fontSize = fontSize.toString() + "px";
|
138
140
|
btn.append(btnRect);
|
139
|
-
btn.append(
|
141
|
+
btn.append(btnFO);
|
140
142
|
(_a = this.interactionOverlay.querySelector("#manipulatorCanvas")) === null || _a === void 0 ? void 0 : _a.append(btn);
|
141
143
|
}
|
142
144
|
});
|
@@ -46,12 +46,22 @@ class Tabbar {
|
|
46
46
|
this.exclusiveSelectHandler = (function exclusiveSelectHandler(e) {
|
47
47
|
this.exclusiveSelect(e);
|
48
48
|
}).bind(this);
|
49
|
-
this.styleCache = new Map();
|
50
49
|
this.sidebarHandler = (function sidebarHandler(e) {
|
51
50
|
var _a, _b;
|
52
51
|
//toggle
|
53
52
|
var that = this;
|
54
53
|
var elParent;
|
54
|
+
// initial style caching
|
55
|
+
if (!this.styleCache) {
|
56
|
+
this.styleCache = new Map();
|
57
|
+
Array.from(cq.getContainer(this.containerId).querySelectorAll(".openSidebar, .closedSidebar")).forEach(el => {
|
58
|
+
elParent = el.parentElement;
|
59
|
+
elParent.querySelectorAll(":scope > div").forEach(d => {
|
60
|
+
that.styleCache.set(d.id, d.getAttribute("style"));
|
61
|
+
});
|
62
|
+
});
|
63
|
+
return;
|
64
|
+
}
|
55
65
|
if (this.sidebar.classList.contains("closedSidebar")) {
|
56
66
|
Array.from(cq.getContainer(this.containerId).querySelectorAll(".closedSidebar")).forEach(el => {
|
57
67
|
elParent = el.parentElement;
|
@@ -63,15 +73,14 @@ class Tabbar {
|
|
63
73
|
(_b = (_a = document.getElementById(that.containerId)) === null || _a === void 0 ? void 0 : _a.querySelector("#" + key)) === null || _b === void 0 ? void 0 : _b.setAttribute("style", value);
|
64
74
|
}
|
65
75
|
}
|
66
|
-
that.styleCache = new Map()
|
76
|
+
//that.styleCache = new Map<string, string>()
|
67
77
|
}
|
68
78
|
else {
|
69
|
-
//document.getElementById("sidebarContainer").style.width = "0"
|
70
79
|
Array.from(cq.getContainer(this.containerId).querySelectorAll(".openSidebar")).forEach(el => {
|
71
80
|
elParent = el.parentElement;
|
72
81
|
elParent.querySelectorAll(":scope > div").forEach(d => {
|
73
82
|
that.styleCache.set(d.id, d.getAttribute("style"));
|
74
|
-
d.removeAttribute("style")
|
83
|
+
//d.removeAttribute("style")
|
75
84
|
});
|
76
85
|
el.classList.add("closedSidebar");
|
77
86
|
el.classList.remove("openSidebar");
|
@@ -271,7 +271,7 @@ class AnnotationChangeHandler {
|
|
271
271
|
var pt = coordinates.transformToDOMMatrixCoordinates(event.clientX, event.clientY, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas")); //new DOMPoint(event.clientX, event.clientY)
|
272
272
|
var edx = pt.x; //.matrixTransform(this.canvasMatrix).x
|
273
273
|
var edy = pt.y; //matrixTransform(this.canvasMatrix).y
|
274
|
-
var ptDist = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, event.target.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
274
|
+
var ptDist = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, event.target.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
275
275
|
var distX = (parseFloat(target.getAttribute('distX'))) || edx - ptDist.x; //matrixTransform(this.canvasMatrix).x
|
276
276
|
var distY = (parseFloat(target.getAttribute('distY'))) || edy - ptDist.y; //matrixTransform(this.canvasMatrix).y
|
277
277
|
target.setAttribute("distX", distX.toString());
|
@@ -589,6 +589,18 @@ class AnnotationChangeHandler {
|
|
589
589
|
}
|
590
590
|
setAnnotations(annotations) {
|
591
591
|
this.annotations = annotations;
|
592
|
+
// this.annotations.forEach(annot => {
|
593
|
+
// var annotElement = cq.getInteractOverlay(this.containerId).querySelector("#" + annot.sourceID + " .annotFO") as HTMLElement
|
594
|
+
// var h = annotElement.getBoundingClientRect().height
|
595
|
+
// var w = annotElement.getBoundingClientRect().width
|
596
|
+
// var ratio = parseFloat(annot.originalWidth) / w
|
597
|
+
// if(isNaN(ratio)) return
|
598
|
+
// annot.originalWidth = (w * ratio).toString()
|
599
|
+
// annot.originalHeight = (h * ratio).toString()
|
600
|
+
// annotElement.style.height = annot.originalHeight.toString() + "px"
|
601
|
+
// annotElement.style.width = annot.originalWidth.toString() + "px"
|
602
|
+
// console.log(annot, annotElement, this.annotations)
|
603
|
+
// })
|
592
604
|
// var newFactor = parseInt((cq.getContainer(this.containerId).querySelector("#svgContainer") as HTMLElement).style?.width?.split("%")[0]) || 100
|
593
605
|
// if (newFactor === this.factor) return this
|
594
606
|
// var that = this
|
@@ -27,9 +27,9 @@ class InsertModeHandler {
|
|
27
27
|
}
|
28
28
|
activateInsertMode(clicked = false) {
|
29
29
|
var _a;
|
30
|
-
if (this.annotationMode || this.harmonyMode) {
|
31
|
-
|
32
|
-
}
|
30
|
+
// if (this.annotationMode || this.harmonyMode) {
|
31
|
+
// this.insertDeactivate()
|
32
|
+
// }
|
33
33
|
// if (clicked) {
|
34
34
|
// if (this.unselectMenuItem("clickInsert")) { return }
|
35
35
|
// }
|
@@ -76,17 +76,13 @@ class PhantomElementHandler {
|
|
76
76
|
var _a, _b, _c, _d, _e;
|
77
77
|
if (this.m2s.getLastMouseEnter().staff === null)
|
78
78
|
return;
|
79
|
-
// var pt = coordinates.transformToDOMMatrixCoordinates(e.clientX, e.clientY, this.interactionOverlay)
|
80
|
-
// var relX = pt.x
|
81
|
-
// var relY = pt.y
|
82
79
|
var definitionScale = (_b = cq.getVrvSVG(this.containerId).querySelector("#" + ((_a = this.m2s.getLastMouseEnter().staff) === null || _a === void 0 ? void 0 : _a.getAttribute("refId")))) === null || _b === void 0 ? void 0 : _b.closest(".definition-scale");
|
83
|
-
if (definitionScale
|
80
|
+
if (!definitionScale)
|
84
81
|
return;
|
85
|
-
var pt = coordinates.transformToDOMMatrixCoordinates(e.clientX, e.clientY, this.
|
82
|
+
var pt = coordinates.transformToDOMMatrixCoordinates(e.clientX, e.clientY, cq.getInteractOverlay(this.containerId));
|
86
83
|
var relX = pt.x;
|
87
84
|
var relY = pt.y;
|
88
|
-
var dsCoords = coordinates.getDOMMatrixCoordinates(definitionScale,
|
89
|
-
//console.log(relX, dsCoords, definitionScale.getBoundingClientRect())
|
85
|
+
var dsCoords = coordinates.getDOMMatrixCoordinates(definitionScale, cq.getInteractOverlay(this.containerId));
|
90
86
|
if (relX < dsCoords.left || relX > dsCoords.right) {
|
91
87
|
this.isTrackingMouse = false;
|
92
88
|
return;
|
@@ -117,9 +113,6 @@ class PhantomElementHandler {
|
|
117
113
|
});
|
118
114
|
this.setPhantomLineListeners();
|
119
115
|
}
|
120
|
-
// if(e.type === "draggingNote"){
|
121
|
-
// console.log(phantomNoteElement, this.phantomLines)
|
122
|
-
// }
|
123
116
|
}
|
124
117
|
removeLines() {
|
125
118
|
var lines = this.interactionOverlay.querySelectorAll(".phantomLine");
|
@@ -4,10 +4,6 @@ const cq = require("../utils/convenienceQueries");
|
|
4
4
|
const meiConverter = require("../utils/MEIConverter");
|
5
5
|
class WindowHandler {
|
6
6
|
constructor() {
|
7
|
-
/**
|
8
|
-
* Update all elements that are affected by a window size change
|
9
|
-
*/
|
10
|
-
this.scrollingTimer = new Array();
|
11
7
|
this.updateFunction = this.update.bind(this);
|
12
8
|
/**
|
13
9
|
* Reload svg when registered events ended
|
@@ -26,17 +22,18 @@ class WindowHandler {
|
|
26
22
|
while (this.w !== this.w.parent) {
|
27
23
|
this.w = this.w.parent;
|
28
24
|
}
|
25
|
+
this.scrollingTimer = new Array();
|
29
26
|
}
|
30
27
|
setListeners() {
|
31
28
|
this.eventContainer = this.container;
|
32
29
|
window.addEventListener("scroll", this.updateFunction);
|
33
30
|
//window.addEventListener("resize", this.update)
|
34
|
-
this.w.addEventListener("resize", this.reloadSVGFunction)
|
31
|
+
//this.w.addEventListener("resize", this.reloadSVGFunction)
|
35
32
|
this.w.addEventListener("deviceorientation", this.updateFunction);
|
36
33
|
this.eventContainer.querySelector("#sidebarContainer").addEventListener("transitionend", this.updateFunction);
|
37
|
-
this.eventContainer.querySelector("#sidebarContainer").addEventListener("transitionend", this.reloadSVGFunction)
|
34
|
+
//this.eventContainer.querySelector("#sidebarContainer").addEventListener("transitionend", this.reloadSVGFunction)
|
38
35
|
this.eventContainer.querySelector("#sidebarContainer").addEventListener("resizemove", this.updateFunction);
|
39
|
-
this.eventContainer.querySelector("#sidebarContainer").addEventListener("resizemove", this.reloadSVGFunction)
|
36
|
+
//this.eventContainer.querySelector("#sidebarContainer").addEventListener("resizemove", this.reloadSVGFunction)
|
40
37
|
this.vrvSVG.addEventListener("scroll", this.updateFunction);
|
41
38
|
//this.vrvSVG.addEventListener("resize", this.update)
|
42
39
|
this.vrvSVG.addEventListener("deviceorientation", this.updateFunction);
|
@@ -71,6 +68,9 @@ class WindowHandler {
|
|
71
68
|
(_h = this.eventContainer) === null || _h === void 0 ? void 0 : _h.removeEventListener("loadingEnd", this.loadContainerAttrFunction);
|
72
69
|
return this;
|
73
70
|
}
|
71
|
+
/**
|
72
|
+
* Update all elements that are affected by a window size change
|
73
|
+
*/
|
74
74
|
update(e) {
|
75
75
|
var _a;
|
76
76
|
// special rule for transition events since so much with different propertynames are fired
|