vibe-editor 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/package.json +66 -61
  2. package/src/scripts/js/Core.js +28 -9
  3. package/src/scripts/js/entry.js +6 -5
  4. package/src/scripts/js/gui/Annotations.js +27 -12
  5. package/src/scripts/js/gui/ScoreManipulator.js +6 -4
  6. package/src/scripts/js/gui/Tabbar.js +13 -4
  7. package/src/scripts/js/handlers/AnnotationChangeHandler.js +13 -1
  8. package/src/scripts/js/handlers/InsertModeHandler.js +3 -3
  9. package/src/scripts/js/handlers/PhantomElementHandler.js +3 -10
  10. package/src/scripts/js/handlers/WindowHandler.js +7 -7
  11. package/src/scripts/js/scripts/Core.js +932 -0
  12. package/src/scripts/js/scripts/MusicProcessor.js +810 -0
  13. package/src/scripts/js/scripts/VIBE.js +219 -0
  14. package/src/scripts/js/scripts/datastructures/MeasureMatrix.js +156 -0
  15. package/src/scripts/js/scripts/gui/Annotations.js +549 -0
  16. package/src/scripts/js/scripts/gui/Cursor.js +203 -0
  17. package/src/scripts/js/scripts/gui/PhantomElement.js +132 -0
  18. package/src/scripts/js/scripts/gui/ScoreManipulator.js +188 -0
  19. package/src/scripts/js/scripts/gui/Tabbar.js +705 -0
  20. package/src/scripts/js/{gui/Toolbar copy.js → scripts/gui/Toolbar.js} +15 -11
  21. package/src/scripts/js/scripts/handlers/AnnotationChangeHandler.js +650 -0
  22. package/src/scripts/js/scripts/handlers/ClickModeHandler.js +535 -0
  23. package/src/scripts/js/{gui → scripts/handlers}/CustomAnnotationShapeDrawer.js +34 -17
  24. package/src/scripts/js/{handlers/ModHandler.js → scripts/handlers/CustomToolbarHandler.js} +54 -66
  25. package/src/scripts/js/scripts/handlers/GlobalKeyboardHandler.js +372 -0
  26. package/src/scripts/js/scripts/handlers/Handler.js +2 -0
  27. package/src/scripts/js/{handlers/InsertModeHandler_deprecated.js → scripts/handlers/InsertModeHandler.js} +117 -164
  28. package/src/scripts/js/scripts/handlers/KeyModeHandler.js +405 -0
  29. package/src/scripts/js/scripts/handlers/LabelHandler.js +463 -0
  30. package/src/scripts/js/scripts/handlers/NoteDragHandler.js +97 -0
  31. package/src/scripts/js/scripts/handlers/PhantomElementHandler.js +161 -0
  32. package/src/scripts/js/scripts/handlers/ScoreManipulatorHandler.js +233 -0
  33. package/src/scripts/js/scripts/handlers/SidebarHandler.js +506 -0
  34. package/src/scripts/js/scripts/handlers/TooltipHandler.js +132 -0
  35. package/src/scripts/js/scripts/handlers/WindowHandler.js +278 -0
  36. package/src/scripts/js/scripts/utils/MEIOperations.js +2121 -0
  37. package/src/scripts/js/{utils/Mouse2MEI.js → scripts/utils/Mouse2SVG.js} +225 -57
  38. package/src/scripts/js/scripts/utils/SVGEditor.js +453 -0
  39. package/src/scripts/js/scripts/utils/Types.js +2 -0
  40. package/src/scripts/js/{utils/VerovioWrapper copy.js → scripts/utils/VerovioWrapper.js} +32 -18
  41. package/src/scripts/js/scripts/utils/coordinates.js +78 -0
  42. package/src/scripts/js/utils/Mouse2SVG.js +11 -4
  43. package/src/scripts/js/utils/VerovioWrapper.js +4 -4
  44. package/src/scripts/js/utils/coordinates.js +26 -2
  45. package/src/styles/vibe.css +32 -6
  46. package/src/scripts/js/.DS_Store +0 -0
  47. package/src/scripts/js/MusicPlayer.js +0 -572
  48. package/src/scripts/js/datastructures/ScoreGraph copy.js +0 -432
  49. package/src/scripts/js/gui/CustomAnnotationDrawer.js +0 -114
  50. package/src/scripts/js/handlers/AnnotationDragHandler.js +0 -113
  51. package/src/scripts/js/handlers/AnnotationLineHandler.js +0 -113
  52. package/src/scripts/js/handlers/ArticulationHandler.js +0 -20
  53. package/src/scripts/js/handlers/HarmonyHandler.js +0 -282
  54. package/src/scripts/js/handlers/InsertModeHandler copy.js +0 -423
  55. package/src/scripts/js/handlers/KeyModeHandler copy.js +0 -407
  56. package/src/scripts/js/handlers/KeyModeHandler_deprecated.js +0 -411
  57. package/src/scripts/js/handlers/NoteDragHandler copy.js +0 -148
  58. package/src/scripts/js/handlers/NoteDragHandler_deprecated.js +0 -150
  59. package/src/scripts/js/handlers/SelectionHandler.js +0 -262
  60. package/src/scripts/js/utils/RectWrapper.js +0 -10
  61. package/src/scripts/js/utils/SVGFiller.js +0 -245
  62. package/src/scripts/js/utils/VerovioWrapperLocal.js +0 -156
  63. package/src/scripts/js/utils/firefoxBBoxes.js +0 -143
  64. /package/src/scripts/js/{assets → scripts/assets}/mei_template.js +0 -0
  65. /package/src/scripts/js/{constants.js → scripts/constants.js} +0 -0
  66. /package/src/scripts/js/{datastructures → scripts/datastructures}/ScoreGraph.js +0 -0
  67. /package/src/scripts/js/{datastructures → scripts/datastructures}/ScoreGraph_deprecated.js +0 -0
  68. /package/src/scripts/js/{datastructures → scripts/datastructures}/ScoreNode.js +0 -0
  69. /package/src/scripts/js/{gui → scripts/gui}/HarmonyLabel.js +0 -0
  70. /package/src/scripts/js/{gui → scripts/gui}/Label.js +0 -0
  71. /package/src/scripts/js/{gui → scripts/gui}/TempoLabel.js +0 -0
  72. /package/src/scripts/js/{handlers → scripts/handlers}/DeleteHandler.js +0 -0
  73. /package/src/scripts/js/{utils → scripts/utils}/DOMCreator.js +0 -0
  74. /package/src/scripts/js/{utils → scripts/utils}/MEIConverter.js +0 -0
  75. /package/src/scripts/js/{utils → scripts/utils}/ReactWrapper.js +0 -0
  76. /package/src/scripts/js/{utils → scripts/utils}/convenienceQueries.js +0 -0
  77. /package/src/scripts/js/{utils → scripts/utils}/mappings.js +0 -0
  78. /package/src/scripts/js/{utils → scripts/utils}/random.js +0 -0
package/package.json CHANGED
@@ -1,63 +1,68 @@
1
1
  {
2
- "name": "vibe-editor",
3
- "version": "0.0.4",
4
- "main": "src/scripts/js/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=production"
13
- },
14
- "files": [
15
- "src/images/*/*",
16
- "src/scripts/js/*",
17
- "src/fonts/*",
18
- "src/styles/*.css"
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
- "interactjs": "1.10.11",
41
- "midi-player-js": "^2.0.16",
42
- "mini-css-extract-plugin": "^2.6.0",
43
- "node-sass": "^7.0.1",
44
- "postcss-loader": "^6.2.1",
45
- "react-color": "^2.19.3",
46
- "react-dom": "^18.2.0",
47
- "sass-loader": "^12.6.0",
48
- "soundfont-player": "^0.12.0",
49
- "style-loader": "^3.3.1",
50
- "tone": "^14.7.77",
51
- "typescript": "4.6.3",
52
- "update": "^0.7.4",
53
- "web-midi-api": "^2.2.5",
54
- "webpack": "^5.88.2",
55
- "webpack-bundle-analyzer": "^4.5.0",
56
- "webpack-cli": "^4.9.2"
57
- },
58
- "devDependencies": {
59
- "@types/verovio": "^3.13.0",
60
- "raw-loader": "^4.0.2",
61
- "url-loader": "^4.1.1"
62
- }
2
+ "name": "vibe-editor",
3
+ "version": "0.0.6",
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
+ "src/styles/*.css"
20
+ ],
21
+ "dependencies": {
22
+ "@babel/plugin-transform-classes": "^7.16.7",
23
+ "@babel/preset-env": "^7.16.11",
24
+ "@popperjs/core": "^2.11.6",
25
+ "@tonejs/midi": "^2.0.28",
26
+ "@types/react": "^18.2.28",
27
+ "@types/react-dom": "^18.2.13",
28
+ "axios": "^1.4.0",
29
+ "babel": "^6.23.0",
30
+ "babel-loader": "^8.2.3",
31
+ "bootstrap": "^5.1.3",
32
+ "brotli-webpack-plugin": "^1.1.0",
33
+ "buffer": "^5.7.1",
34
+ "compression-webpack-plugin": "^9.2.0",
35
+ "css-loader": "^6.7.1",
36
+ "d3": "^5.11.0",
37
+ "esbuild": "0.17.14",
38
+ "eslint-plugin-react-hooks": "^4.6.0",
39
+ "file-loader": "^6.2.0",
40
+ "h5p-lib-controls": "^0.0.15",
41
+ "html-webpack-plugin": "^5.6.0",
42
+ "interactjs": "1.10.11",
43
+ "midi-player-js": "^2.0.16",
44
+ "mini-css-extract-plugin": "^2.6.0",
45
+ "node-sass": "^7.0.1",
46
+ "postcss-loader": "^6.2.1",
47
+ "react-color": "^2.19.3",
48
+ "react-dom": "^18.2.0",
49
+ "sass-loader": "^12.6.0",
50
+ "soundfont-player": "^0.12.0",
51
+ "style-loader": "^3.3.1",
52
+ "svg-url-loader": "^8.0.0",
53
+ "tone": "^14.7.77",
54
+ "ts-loader": "^9.5.1",
55
+ "typescript": "4.6.3",
56
+ "update": "^0.7.4",
57
+ "web-midi-api": "^2.2.5",
58
+ "webpack": "^5.88.2",
59
+ "webpack-bundle-analyzer": "^4.5.0",
60
+ "webpack-cli": "^4.9.2"
61
+ },
62
+ "devDependencies": {
63
+ "@types/verovio": "^3.13.0",
64
+ "raw-loader": "^4.0.2",
65
+ "url-loader": "^4.1.1"
66
+ },
67
+ "description": "Current version in npm repo: ![npm](https://img.shields.io/npm/v/vibe-editor)"
63
68
  }
@@ -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 (options === null || options === void 0 ? void 0 : options.widthFactor) {
229
- console.log("pageW before", that.verovioWrapper.getOptions().pageWidth);
230
- that.verovioWrapper.setWidthValue(parseFloat(that.verovioWrapper.getOptions().pageWidth) * options.widthFactor);
231
- console.log("pageW after", that.verovioWrapper.getOptions().pageWidth);
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();
@@ -1,5 +1,6 @@
1
- import VIBE from "./VIBE.js"
2
-
3
- export default function createEditor(container, options, meiCallback){
4
- return new VIBE(container, options, meiCallback)
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 annotationTarget = this.m2s.findScoreTarget(posx, posy, false);
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 = annotationTarget.x.toString();
329
- const lY1 = annotationTarget.y.toString();
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
- // relativePos: {
347
- // x: textGroup.getBoundingClientRect().x - annotationTarget.getBoundingClientRect().x,
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).querySelector("#annotationCanvas"));
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 btnText = document.createElementNS("http://www.w3.org/2000/svg", "text");
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
- btnText.setAttribute("x", "30%");
137
- btnText.setAttribute("y", "80%");
138
+ var fontSize = btnHeight;
139
+ btnText.style.fontSize = fontSize.toString() + "px";
138
140
  btn.append(btnRect);
139
- btn.append(btnText);
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")); //new DOMPoint(target.getBoundingClientRect().x, event.target.getBoundingClientRect().y)
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
- this.insertDeactivate();
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 == undefined || definitionScale == null)
80
+ if (!definitionScale)
84
81
  return;
85
- var pt = coordinates.transformToDOMMatrixCoordinates(e.clientX, e.clientY, this.interactionOverlay);
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, definitionScale.closest(".page"));
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