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.
- package/package.json +66 -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 +161 -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} +32 -18
- package/src/scripts/js/scripts/utils/coordinates.js +78 -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/styles/vibe.css +32 -6
- 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/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
@@ -0,0 +1,650 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const interactjs_1 = require("interactjs");
|
4
|
+
const cq = require("../utils/convenienceQueries");
|
5
|
+
const coordinates = require("../utils/coordinates");
|
6
|
+
/**
|
7
|
+
* Handle Interaction with annotation text and shape elements (drag & resize)
|
8
|
+
*/
|
9
|
+
class AnnotationChangeHandler {
|
10
|
+
constructor(containerId) {
|
11
|
+
this.selectColorsHandler = (function selectColorsHandler() {
|
12
|
+
this.setColors();
|
13
|
+
}).bind(this);
|
14
|
+
// change to function after implementation
|
15
|
+
this.selectHandler = (function selectHandler(e) {
|
16
|
+
var target = e.target;
|
17
|
+
if (target.tagName === "rect") {
|
18
|
+
var bbox = target.getBoundingClientRect();
|
19
|
+
this.attachCornerCircle(target, bbox.x, bbox.y);
|
20
|
+
}
|
21
|
+
//TODO: Circles etc
|
22
|
+
}).bind(this);
|
23
|
+
this.setContainerId(containerId);
|
24
|
+
//this.update()
|
25
|
+
this.annotResizedEvent = new Event("annotResized");
|
26
|
+
this.dragAnnotStartEvent = new Event("dragAnnotStart");
|
27
|
+
this.dragAnnotEndEvent = new Event("dragAnnotEnd");
|
28
|
+
this.isInteracting = false;
|
29
|
+
this.factor = 100;
|
30
|
+
}
|
31
|
+
setListeners() {
|
32
|
+
//if(document.getElementById(this.containerId).querySelector(".sidebar.openSidebar") != null) return
|
33
|
+
var that = this;
|
34
|
+
this.shapeListener = interactjs_1.default("#" + this.containerId + " #interactionOverlay .customAnnotShape")
|
35
|
+
.resizable({
|
36
|
+
// resize from all edges and corners
|
37
|
+
edges: { left: true, right: true, bottom: true, top: true },
|
38
|
+
listeners: {
|
39
|
+
move: this.resizeShapeListener.bind(this),
|
40
|
+
end(event) {
|
41
|
+
that.interactionOverlay.dispatchEvent(new Event("annotationCanvasChanged"));
|
42
|
+
that.deleteTempDistances();
|
43
|
+
that.interactTarget.dispatchEvent(that.annotResizedEvent);
|
44
|
+
that.isInteracting = false;
|
45
|
+
}
|
46
|
+
},
|
47
|
+
})
|
48
|
+
.draggable({
|
49
|
+
listeners: {
|
50
|
+
move: this.dragShapeListener.bind(this),
|
51
|
+
end(event) {
|
52
|
+
that.interactionOverlay.dispatchEvent(new Event("annotationCanvasChanged"));
|
53
|
+
that.deleteTempDistances();
|
54
|
+
that.interactTarget.dispatchEvent(that.dragAnnotEndEvent);
|
55
|
+
that.isInteracting = false;
|
56
|
+
}
|
57
|
+
},
|
58
|
+
modifiers: [
|
59
|
+
interactjs_1.default.modifiers.restrictRect({
|
60
|
+
restriction: 'parent',
|
61
|
+
endOnly: true
|
62
|
+
})
|
63
|
+
]
|
64
|
+
});
|
65
|
+
this.textListener = interactjs_1.default("#" + this.containerId + " .annotText")
|
66
|
+
.resizable({
|
67
|
+
// resize from all edges and corners
|
68
|
+
edges: { left: true, right: true, bottom: true, top: true },
|
69
|
+
listeners: {
|
70
|
+
move: this.resizeTextListener.bind(this),
|
71
|
+
end(event) {
|
72
|
+
that.deleteTempDistances();
|
73
|
+
that.interactionOverlay.dispatchEvent(new Event("annotationCanvasChanged"));
|
74
|
+
that.interactTarget.dispatchEvent(that.annotResizedEvent);
|
75
|
+
that.isInteracting = false;
|
76
|
+
}
|
77
|
+
},
|
78
|
+
})
|
79
|
+
.draggable({
|
80
|
+
listeners: {
|
81
|
+
move: this.dragTextListener.bind(this),
|
82
|
+
end(event) {
|
83
|
+
that.interactionOverlay.dispatchEvent(new Event("annotationCanvasChanged"));
|
84
|
+
that.deleteTempDistances();
|
85
|
+
that.interactTarget.dispatchEvent(that.dragAnnotEndEvent);
|
86
|
+
that.isInteracting = false;
|
87
|
+
}
|
88
|
+
},
|
89
|
+
modifiers: [
|
90
|
+
interactjs_1.default.modifiers.restrictRect({
|
91
|
+
restriction: 'parent',
|
92
|
+
endOnly: true
|
93
|
+
})
|
94
|
+
]
|
95
|
+
});
|
96
|
+
this.lineListener = interactjs_1.default("#" + this.containerId + " #interactionOverlay .lineDragRect.x1")
|
97
|
+
.draggable({
|
98
|
+
listeners: {
|
99
|
+
move: this.dragLineListener.bind(this),
|
100
|
+
end(event) {
|
101
|
+
that.snapToObj();
|
102
|
+
that.interactionOverlay.dispatchEvent(new Event("annotationCanvasChanged"));
|
103
|
+
that.deleteTempDistances();
|
104
|
+
that.interactTarget.dispatchEvent(that.dragAnnotEndEvent);
|
105
|
+
that.isInteracting = false;
|
106
|
+
}
|
107
|
+
},
|
108
|
+
modifiers: [
|
109
|
+
interactjs_1.default.modifiers.restrictRect({
|
110
|
+
restriction: 'parent',
|
111
|
+
endOnly: true
|
112
|
+
})
|
113
|
+
]
|
114
|
+
});
|
115
|
+
// this.colorObserver = new MutationObserver(function(mutations){
|
116
|
+
// mutations.forEach(mutation => {
|
117
|
+
// if(mutation.type !== "attributes") return
|
118
|
+
// if(mutation.attributeName === "selectedcolor"){
|
119
|
+
// that.setColors()
|
120
|
+
// }
|
121
|
+
// })
|
122
|
+
// })
|
123
|
+
// this.colorObserver.observe(cq.getContainer(this.containerId).querySelector("#colorGroup"), {
|
124
|
+
// attributes: true
|
125
|
+
// })
|
126
|
+
cq.getContainer(this.containerId).querySelector("#colorGroup").addEventListener("change", this.selectColorsHandler);
|
127
|
+
}
|
128
|
+
removeListeners() {
|
129
|
+
var _a, _b, _c;
|
130
|
+
//interact(".customAnnotShape, .annotLinkedText, .lineDragRect").unset()
|
131
|
+
(_a = this.shapeListener) === null || _a === void 0 ? void 0 : _a.unset();
|
132
|
+
(_b = this.lineListener) === null || _b === void 0 ? void 0 : _b.unset();
|
133
|
+
(_c = this.textListener) === null || _c === void 0 ? void 0 : _c.unset();
|
134
|
+
//this.colorObserver?.disconnect()
|
135
|
+
cq.getContainer(this.containerId).querySelector("#colorGroup").removeEventListener("change", this.selectColorsHandler);
|
136
|
+
}
|
137
|
+
resetListeners() {
|
138
|
+
this.removeListeners();
|
139
|
+
this.setListeners();
|
140
|
+
}
|
141
|
+
/**
|
142
|
+
* set selected color to all marked elements
|
143
|
+
* color hex is set in the #colorGroup element
|
144
|
+
* @returns
|
145
|
+
*/
|
146
|
+
setColors() {
|
147
|
+
var color = cq.getContainer(this.containerId).querySelector("#colorGroup").getAttribute("selectedcolor");
|
148
|
+
if (!color)
|
149
|
+
return;
|
150
|
+
cq.getContainer(this.containerId).querySelectorAll(".marked").forEach(m => {
|
151
|
+
m.style.fill = color;
|
152
|
+
});
|
153
|
+
cq.getContainer(this.containerId).querySelectorAll(".annotText.selected [contenteditable]").forEach(c => {
|
154
|
+
if (c.closest(".annotLinkedText")) {
|
155
|
+
color += "1A";
|
156
|
+
} //add transparency of 0.1
|
157
|
+
c.style.backgroundColor = color;
|
158
|
+
//change color in annotlist
|
159
|
+
const id = c.closest("g").id;
|
160
|
+
const annotListElement = cq.getContainer(this.containerId).querySelector(`#annotList > [refid=${id}]`);
|
161
|
+
if (!annotListElement)
|
162
|
+
return;
|
163
|
+
annotListElement.style.backgroundColor = color;
|
164
|
+
});
|
165
|
+
}
|
166
|
+
// SHAPES
|
167
|
+
dragShapeListener(event) {
|
168
|
+
var target = event.target;
|
169
|
+
this.interactTarget = target;
|
170
|
+
if (!this.isInteracting) {
|
171
|
+
this.interactTarget.dispatchEvent(this.dragAnnotStartEvent);
|
172
|
+
}
|
173
|
+
this.isInteracting = true;
|
174
|
+
//var pt = coordinates.transformToDOMMatrixCoordinates(event.clientX, event.clientY, this.interactionOverlay) //new DOMPoint(event.clientX, event.clientY)
|
175
|
+
var pt = coordinates.transformToDOMMatrixCoordinates(event.clientX, event.clientY, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas")); //new DOMPoint(event.clientX, event.clientY)
|
176
|
+
var edx = pt.x; //pt.matrixTransform(this.canvasMatrix).x
|
177
|
+
var edy = pt.y; //pt.matrixTransform(this.canvasMatrix).y
|
178
|
+
//var ptDist = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, event.target.getBoundingClientRect().y, this.interactionOverlay)// new DOMPoint(target.getBoundingClientRect().x, event.target.getBoundingClientRect().y)
|
179
|
+
var ptDist = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, target.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
180
|
+
var distX = (parseFloat(target.getAttribute('distX'))) || edx - ptDist.x; //ptDist.matrixTransform(this.canvasMatrix).x
|
181
|
+
var distY = (parseFloat(target.getAttribute('distY'))) || edy - ptDist.y; //ptDist.matrixTransform(this.canvasMatrix).y
|
182
|
+
target.setAttribute("distX", distX.toString());
|
183
|
+
target.setAttribute("distY", distY.toString());
|
184
|
+
target.setAttribute("x", (edx - distX).toString());
|
185
|
+
target.setAttribute("y", (edy - distY).toString());
|
186
|
+
var targetParent = target.parentElement;
|
187
|
+
var line = targetParent.querySelector(":scope > .annotLine");
|
188
|
+
//pt = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, event.target.getBoundingClientRect().y, this.interactionOverlay) //new DOMPoint(target.getBoundingClientRect().x, target.getBoundingClientRect().y)
|
189
|
+
pt = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, target.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
190
|
+
var rectX = pt.x.toString(); //pt.matrixTransform(this.canvasMatrix).x.toString()
|
191
|
+
var rectY = pt.y.toString(); //pt.matrixTransform(this.canvasMatrix).y.toString()
|
192
|
+
if (line) {
|
193
|
+
line.setAttribute("x1", rectX);
|
194
|
+
line.setAttribute("y1", rectY);
|
195
|
+
var xDiff = parseFloat(line.getAttribute("x2")) - parseFloat(rectX);
|
196
|
+
var yDiff = parseFloat(line.getAttribute("y2")) - parseFloat(rectY);
|
197
|
+
line.setAttribute("x-diff", xDiff.toString());
|
198
|
+
line.setAttribute("y-diff", yDiff.toString());
|
199
|
+
}
|
200
|
+
var dragRects = targetParent === null || targetParent === void 0 ? void 0 : targetParent.querySelectorAll(".lineDragRect");
|
201
|
+
if (dragRects.length > 0) {
|
202
|
+
dragRects.forEach(dr => {
|
203
|
+
if (dr.classList.contains("x1")) {
|
204
|
+
dr.setAttribute("x", rectX);
|
205
|
+
dr.setAttribute("y", rectY);
|
206
|
+
}
|
207
|
+
});
|
208
|
+
}
|
209
|
+
}
|
210
|
+
resizeShapeListener(event) {
|
211
|
+
var target = event.target;
|
212
|
+
this.interactTarget = target;
|
213
|
+
cq.getContainer(this.containerId).classList.add("annotMode");
|
214
|
+
// update overal dimensions
|
215
|
+
var pt = coordinates.getDOMMatrixCoordinates(event.rect, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
216
|
+
target.style.width = pt.width + 'px';
|
217
|
+
target.style.height = pt.height + 'px';
|
218
|
+
// translate when resizing from top or left edges
|
219
|
+
if (event.edges.top === true || event.edges.left === true) {
|
220
|
+
var edgesPt = coordinates.transformToDOMMatrixCoordinates(event.clientX, event.clientY, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas")); // new DOMPoint(event.clientX, event.clientY)
|
221
|
+
var edx = edgesPt.x; //pt.matrixTransform(this.canvasMatrix).x
|
222
|
+
var edy = edgesPt.y; //pt.matrixTransform(this.canvasMatrix).y
|
223
|
+
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)
|
224
|
+
var distX = (parseFloat(target.getAttribute('distX'))) || edx - ptDist.x; //ptDist.matrixTransform(this.canvasMatrix).x
|
225
|
+
var distY = (parseFloat(target.getAttribute('distY'))) || edy - ptDist.y; //ptDist.matrixTransform(this.canvasMatrix).y
|
226
|
+
target.setAttribute("distX", distX.toString());
|
227
|
+
target.setAttribute("distY", distY.toString());
|
228
|
+
if (event.edges.left === true) {
|
229
|
+
target.setAttribute("x", (edx - distX).toString());
|
230
|
+
}
|
231
|
+
if (event.edges.top === true) {
|
232
|
+
target.setAttribute("y", (edy - distY).toString());
|
233
|
+
}
|
234
|
+
//target.textContent = Math.round(event.rect.width) + '\u00D7' + Math.round(event.rect.height)
|
235
|
+
}
|
236
|
+
//update attached line
|
237
|
+
var targetParent = target.parentElement;
|
238
|
+
var line = targetParent === null || targetParent === void 0 ? void 0 : targetParent.querySelector(".annotLine");
|
239
|
+
var dragRects = targetParent === null || targetParent === void 0 ? void 0 : targetParent.querySelectorAll(".lineDragRect");
|
240
|
+
var rectX = pt.x.toString(); //ptTL.matrixTransform(this.canvasMatrix).x.toString()
|
241
|
+
var rectY = pt.y.toString(); //ptTL.matrixTransform(this.canvasMatrix).y.toString()
|
242
|
+
if (line !== null) {
|
243
|
+
line.setAttribute("x1", rectX);
|
244
|
+
line.setAttribute("y1", rectY);
|
245
|
+
var xDiff = parseFloat(line.getAttribute("x2")) - parseFloat(rectX);
|
246
|
+
var yDiff = parseFloat(line.getAttribute("y2")) - parseFloat(rectY);
|
247
|
+
line.setAttribute("x-diff", xDiff.toString());
|
248
|
+
line.setAttribute("y-diff", yDiff.toString());
|
249
|
+
}
|
250
|
+
if (dragRects.length > 0) {
|
251
|
+
dragRects.forEach(dr => {
|
252
|
+
if (dr.classList.contains("x1")) {
|
253
|
+
dr.setAttribute("x", rectX);
|
254
|
+
dr.setAttribute("y", rectY);
|
255
|
+
}
|
256
|
+
});
|
257
|
+
}
|
258
|
+
}
|
259
|
+
// TEXTBOXES
|
260
|
+
resizeTextListener(event) {
|
261
|
+
var target = event.target.querySelector(".annotFO");
|
262
|
+
this.interactTarget = target;
|
263
|
+
//this.canvasMatrix = (document.getElementById("annotationCanvas") as unknown as SVGGraphicsElement).getScreenCTM().inverse()
|
264
|
+
cq.getContainer(this.containerId).classList.add("annotMode");
|
265
|
+
// update overal dimensions
|
266
|
+
var ptTL = coordinates.getDOMMatrixCoordinates(event.rect, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
267
|
+
target.style.width = ptTL.width + 'px';
|
268
|
+
target.style.height = ptTL.height + 'px';
|
269
|
+
// translate when resizing from top or left edges
|
270
|
+
if (event.edges.top === true || event.edges.left === true) {
|
271
|
+
var pt = coordinates.transformToDOMMatrixCoordinates(event.clientX, event.clientY, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas")); //new DOMPoint(event.clientX, event.clientY)
|
272
|
+
var edx = pt.x; //.matrixTransform(this.canvasMatrix).x
|
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"));
|
275
|
+
var distX = (parseFloat(target.getAttribute('distX'))) || edx - ptDist.x; //matrixTransform(this.canvasMatrix).x
|
276
|
+
var distY = (parseFloat(target.getAttribute('distY'))) || edy - ptDist.y; //matrixTransform(this.canvasMatrix).y
|
277
|
+
target.setAttribute("distX", distX.toString());
|
278
|
+
target.setAttribute("distY", distY.toString());
|
279
|
+
if (event.edges.left === true) {
|
280
|
+
target.setAttribute("x", (edx - distX).toString());
|
281
|
+
}
|
282
|
+
if (event.edges.top === true) {
|
283
|
+
target.setAttribute("y", (edy - distY).toString());
|
284
|
+
}
|
285
|
+
//target.textContent = Math.round(event.rect.width) + '\u00D7' + Math.round(event.rect.height)
|
286
|
+
}
|
287
|
+
//update attached line
|
288
|
+
var targetParent = target.closest("g");
|
289
|
+
var line = targetParent === null || targetParent === void 0 ? void 0 : targetParent.querySelector(".annotLine");
|
290
|
+
var dragRects = targetParent === null || targetParent === void 0 ? void 0 : targetParent.querySelectorAll(".lineDragRect");
|
291
|
+
var rectX = ptTL.x.toString(); //.matrixTransform(this.canvasMatrix).x.toString()
|
292
|
+
var rectY = ptTL.y.toString(); //).matrixTransform(this.canvasMatrix).y.toString()
|
293
|
+
if (line !== null) {
|
294
|
+
line.setAttribute("x2", rectX);
|
295
|
+
line.setAttribute("y2", rectY);
|
296
|
+
var xDiff = parseFloat(rectX) - parseFloat(line.getAttribute("x1"));
|
297
|
+
var yDiff = parseFloat(rectY) - parseFloat(line.getAttribute("y1"));
|
298
|
+
line.setAttribute("x-diff", xDiff.toString());
|
299
|
+
line.setAttribute("y-diff", yDiff.toString());
|
300
|
+
}
|
301
|
+
if (dragRects.length > 0) {
|
302
|
+
dragRects.forEach(dr => {
|
303
|
+
if (dr.classList.contains("x2")) {
|
304
|
+
dr.setAttribute("x", rectX);
|
305
|
+
dr.setAttribute("y", rectY);
|
306
|
+
}
|
307
|
+
});
|
308
|
+
}
|
309
|
+
}
|
310
|
+
dragTextListener(event) {
|
311
|
+
var target = event.target.querySelector(".annotFO");
|
312
|
+
this.interactTarget = target;
|
313
|
+
if (!this.isInteracting) {
|
314
|
+
this.interactTarget.dispatchEvent(this.dragAnnotStartEvent);
|
315
|
+
}
|
316
|
+
this.isInteracting = true;
|
317
|
+
//this.canvasMatrix = (document.getElementById("annotationCanvas") as unknown as SVGGraphicsElement).getScreenCTM().inverse()
|
318
|
+
var pt = coordinates.transformToDOMMatrixCoordinates(event.clientX, event.clientY, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas")); //new DOMPoint(event.clientX, event.clientY)
|
319
|
+
var edx = pt.x; //matrixTransform(this.canvasMatrix).x
|
320
|
+
var edy = pt.y; //matrixTransform(this.canvasMatrix).y
|
321
|
+
var ptDist = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, target.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas")); //new DOMPoint(target.getBoundingClientRect().x, event.target.getBoundingClientRect().y)
|
322
|
+
var distX = (parseFloat(target.getAttribute('distX'))) || edx - ptDist.x; //matrixTransform(this.canvasMatrix).x
|
323
|
+
var distY = (parseFloat(target.getAttribute('distY'))) || edy - ptDist.y; //matrixTransform(this.canvasMatrix).y
|
324
|
+
target.setAttribute("distX", distX.toString());
|
325
|
+
target.setAttribute("distY", distY.toString());
|
326
|
+
target.setAttribute("x", (edx - distX).toString());
|
327
|
+
target.setAttribute("y", (edy - distY).toString());
|
328
|
+
var targetParent = target.closest("g");
|
329
|
+
var line = targetParent.querySelector(".annotLine");
|
330
|
+
var dragRects = targetParent.querySelectorAll(".lineDragRect");
|
331
|
+
pt = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, target.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas")); //new DOMPoint(target.getBoundingClientRect().x, target.getBoundingClientRect().y)
|
332
|
+
var rectX = pt.x.toString(); //.matrixTransform(this.canvasMatrix).x.toString()
|
333
|
+
var rectY = pt.y.toString(); //matrixTransform(this.canvasMatrix).y.toString()
|
334
|
+
if (line !== null) {
|
335
|
+
line.setAttribute("x2", rectX);
|
336
|
+
line.setAttribute("y2", rectY);
|
337
|
+
var xDiff = parseFloat(rectX) - parseFloat(line.getAttribute("x1"));
|
338
|
+
var yDiff = parseFloat(rectY) - parseFloat(line.getAttribute("y1"));
|
339
|
+
line.setAttribute("x-diff", xDiff.toString());
|
340
|
+
line.setAttribute("y-diff", yDiff.toString());
|
341
|
+
}
|
342
|
+
if (dragRects.length > 0) {
|
343
|
+
dragRects.forEach(dr => {
|
344
|
+
if (dr.classList.contains("x2")) {
|
345
|
+
dr.setAttribute("x", rectX);
|
346
|
+
dr.setAttribute("y", rectY);
|
347
|
+
}
|
348
|
+
});
|
349
|
+
}
|
350
|
+
}
|
351
|
+
//LINES
|
352
|
+
dragLineListener(event) {
|
353
|
+
//if(document.getElementById(this.containerId).querySelector(".sidebar.openSidebar") != null) return
|
354
|
+
var target = event.target;
|
355
|
+
this.interactTarget = target;
|
356
|
+
if (!this.isInteracting) {
|
357
|
+
this.interactTarget.dispatchEvent(this.dragAnnotStartEvent);
|
358
|
+
}
|
359
|
+
cq.getContainer(this.containerId).classList.add("annotMode");
|
360
|
+
this.isInteracting = true;
|
361
|
+
//this.canvasMatrix = (document.getElementById("annotationCanvas") as unknown as SVGGraphicsElement).getScreenCTM().inverse()
|
362
|
+
this.dragedRect = target;
|
363
|
+
var pt = coordinates.transformToDOMMatrixCoordinates(event.clientX, event.clientY, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas")); //new DOMPoint(event.clientX, event.clientY)
|
364
|
+
var edx = pt.x; //matrixTransform(this.canvasMatrix).x
|
365
|
+
var edy = pt.y; //matrixTransform(this.canvasMatrix).y
|
366
|
+
target.setAttribute("x", edx.toString());
|
367
|
+
target.setAttribute("y", edy.toString());
|
368
|
+
var targetParent = target.closest("g");
|
369
|
+
var line = targetParent.querySelector(".annotLine");
|
370
|
+
pt = coordinates.transformToDOMMatrixCoordinates(target.getBoundingClientRect().x, target.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
371
|
+
var rectX = pt.x.toString(); //.matrixTransform(this.canvasMatrix).x.toString()
|
372
|
+
var rectY = pt.y.toString(); //matrixTransform(this.canvasMatrix).y.toString()
|
373
|
+
if (target.classList.contains("x1")) {
|
374
|
+
line.setAttribute("x1", rectX);
|
375
|
+
line.setAttribute("y1", rectY);
|
376
|
+
var xDiff = parseFloat(line.getAttribute("x2")) - parseFloat(rectX);
|
377
|
+
var yDiff = parseFloat(line.getAttribute("y2")) - parseFloat(rectY);
|
378
|
+
line.setAttribute("x-diff", xDiff.toString());
|
379
|
+
line.setAttribute("y-diff", yDiff.toString());
|
380
|
+
this.highlightNextAttachObject(target);
|
381
|
+
}
|
382
|
+
this.interactionOverlay.dispatchEvent(new Event("annotChanged"));
|
383
|
+
}
|
384
|
+
/**
|
385
|
+
* Highlight the next Element where the lineDragRect could attach to
|
386
|
+
* @param lineDragRect
|
387
|
+
* @returns
|
388
|
+
*/
|
389
|
+
highlightNextAttachObject(lineDragRect) {
|
390
|
+
var pt = coordinates.transformToDOMMatrixCoordinates(lineDragRect.getBoundingClientRect().x, lineDragRect.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
391
|
+
var posx = pt.x;
|
392
|
+
var posy = pt.y;
|
393
|
+
var nextScoreObj = this.m2s.findScoreTarget(posx, posy);
|
394
|
+
var nextShapeObj = this.findCustomShapeTarget(posx, posy);
|
395
|
+
var possibleCoords = new Array();
|
396
|
+
var shapeCoord;
|
397
|
+
if (nextShapeObj !== null) {
|
398
|
+
var shapept = coordinates.transformToDOMMatrixCoordinates(nextShapeObj.getBoundingClientRect().x, nextShapeObj.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
399
|
+
shapeCoord = {
|
400
|
+
obj: nextShapeObj,
|
401
|
+
x: shapept.x,
|
402
|
+
y: shapept.y
|
403
|
+
};
|
404
|
+
possibleCoords.push(shapeCoord);
|
405
|
+
}
|
406
|
+
if (nextScoreObj != undefined) {
|
407
|
+
var measurept = coordinates.transformToDOMMatrixCoordinates(nextScoreObj.parentMeasure.getBoundingClientRect().x, nextScoreObj.parentMeasure.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
408
|
+
var measureCoord = {
|
409
|
+
obj: nextScoreObj.parentMeasure,
|
410
|
+
x: measurept.x,
|
411
|
+
y: measurept.y
|
412
|
+
};
|
413
|
+
possibleCoords.push(measureCoord);
|
414
|
+
var staffpt = coordinates.transformToDOMMatrixCoordinates(nextScoreObj.parentStaff.getBoundingClientRect().x, nextScoreObj.parentStaff.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
415
|
+
var staffCoord = {
|
416
|
+
obj: nextScoreObj.parentStaff,
|
417
|
+
x: staffpt.x,
|
418
|
+
y: staffpt.y
|
419
|
+
};
|
420
|
+
possibleCoords.push(staffCoord);
|
421
|
+
var notept = coordinates.transformToDOMMatrixCoordinates(document.getElementById(nextScoreObj.id).getBoundingClientRect().x, document.getElementById(nextScoreObj.id).getBoundingClientRect().y, this.interactionOverlay);
|
422
|
+
var noteCoord = {
|
423
|
+
obj: cq.getVrvSVG(this.containerId).querySelector("#" + nextScoreObj.id),
|
424
|
+
x: notept.x,
|
425
|
+
y: notept.y
|
426
|
+
};
|
427
|
+
possibleCoords.push(noteCoord);
|
428
|
+
}
|
429
|
+
var tempDist = Math.pow(10, 10);
|
430
|
+
var objToHighlight;
|
431
|
+
var objCoord;
|
432
|
+
possibleCoords.forEach(coord => {
|
433
|
+
var dist = Math.sqrt(Math.abs(coord.x - posx) ** 2 + Math.abs(coord.y - posy) ** 2);
|
434
|
+
if (dist < tempDist) {
|
435
|
+
tempDist = dist;
|
436
|
+
objToHighlight = coord.obj;
|
437
|
+
objCoord = coord;
|
438
|
+
}
|
439
|
+
});
|
440
|
+
this.updateAnnotationIDs(objToHighlight, lineDragRect, objCoord);
|
441
|
+
return objToHighlight;
|
442
|
+
}
|
443
|
+
/**
|
444
|
+
* Find nearest Custom Shape to given Position (e.g. Mouse)
|
445
|
+
* @param posx
|
446
|
+
* @param posy
|
447
|
+
* @returns
|
448
|
+
*/
|
449
|
+
findCustomShapeTarget(posx, posy) {
|
450
|
+
var shapes = Array.from(this.interactionOverlay.querySelectorAll(".customAnnotShape"));
|
451
|
+
var nextShape;
|
452
|
+
var tempDist = Math.pow(10, 10);
|
453
|
+
shapes.forEach(s => {
|
454
|
+
var pt = coordinates.transformToDOMMatrixCoordinates(s.getBoundingClientRect().x, s.getBoundingClientRect().y, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
455
|
+
//var spt = pt.matrixTransform(this.rootMatrix)
|
456
|
+
var dist = Math.sqrt(Math.abs(pt.x - posx) ** 2 + Math.abs(pt.y - posy) ** 2);
|
457
|
+
if (dist < tempDist) {
|
458
|
+
tempDist = dist;
|
459
|
+
nextShape = s;
|
460
|
+
}
|
461
|
+
});
|
462
|
+
if (nextShape == undefined) {
|
463
|
+
return null;
|
464
|
+
}
|
465
|
+
return nextShape;
|
466
|
+
}
|
467
|
+
/**
|
468
|
+
* Update Set of saved Annotations and their relations to Shapes or Score
|
469
|
+
* @param objToAttach
|
470
|
+
* @param lineDragRect
|
471
|
+
*/
|
472
|
+
updateAnnotationIDs(objToAttach, lineDragRect, objCoord) {
|
473
|
+
if (!objToAttach)
|
474
|
+
return;
|
475
|
+
var line;
|
476
|
+
var targetx;
|
477
|
+
var targety;
|
478
|
+
var highlightRect;
|
479
|
+
var parentGroup = lineDragRect.closest("g");
|
480
|
+
document.querySelectorAll(".highlightAnnotation").forEach(h => h.classList.remove("highlightAnnotation"));
|
481
|
+
objToAttach.classList.add("highlightAnnotation");
|
482
|
+
var otaBBox = objToAttach.getBoundingClientRect();
|
483
|
+
this.annotations.some(annot => {
|
484
|
+
var _a;
|
485
|
+
if (annot.sourceID = parentGroup.id) {
|
486
|
+
var pt = coordinates.getDOMMatrixCoordinates(otaBBox, cq.getInteractOverlay(this.containerId).querySelector("#annotationCanvas"));
|
487
|
+
annot.targetID = objToAttach.id;
|
488
|
+
targetx = pt.x;
|
489
|
+
targety = pt.y;
|
490
|
+
// // draw rect for highlighting
|
491
|
+
// if(parentGroup.querySelector(".highlightAnnotation") === null){
|
492
|
+
// highlightRect = document.createElementNS(c._SVGNS_, "rect")
|
493
|
+
// parentGroup.insertBefore(highlightRect, parentGroup.firstChild)
|
494
|
+
// }else{
|
495
|
+
// highlightRect = parentGroup.querySelector(".highlightAnnotation")
|
496
|
+
// }
|
497
|
+
// var highlightMargin = 0
|
498
|
+
// highlightRect.classList.add("highlightAnnotation")
|
499
|
+
// highlightRect.setAttribute("x", (targetx - highlightMargin).toString())
|
500
|
+
// highlightRect.setAttribute("y", (targety - highlightMargin).toString())
|
501
|
+
// highlightRect.setAttribute("height", (pt.height + 2*highlightMargin).toString())
|
502
|
+
// highlightRect.setAttribute("width", (pt.width + 2*highlightMargin).toString())
|
503
|
+
(_a = cq.getInteractOverlay(this.containerId).querySelector(`#${annot.sourceID}`)) === null || _a === void 0 ? void 0 : _a.setAttribute("targetId", objToAttach.id);
|
504
|
+
annot.targetID = objToAttach.id;
|
505
|
+
return annot.sourceID === parentGroup.id;
|
506
|
+
}
|
507
|
+
});
|
508
|
+
this.snapCoords = {
|
509
|
+
obj: line,
|
510
|
+
x: targetx,
|
511
|
+
y: targety
|
512
|
+
};
|
513
|
+
// some rules for custom shapes
|
514
|
+
if (objToAttach.classList.contains("customAnnotShape")) {
|
515
|
+
parentGroup.querySelector(".highlightAnnotation").remove();
|
516
|
+
// ensure that only one shape is attached
|
517
|
+
if (parentGroup.querySelector(".customAnnotShape") !== null) {
|
518
|
+
var prevShape = parentGroup.querySelector(".customAnnotShape");
|
519
|
+
parentGroup.parentElement.appendChild(prevShape);
|
520
|
+
}
|
521
|
+
parentGroup.insertBefore(objToAttach, parentGroup.firstChild);
|
522
|
+
var newAnnot = {
|
523
|
+
sourceID: objToAttach.id,
|
524
|
+
targetID: new Array()
|
525
|
+
};
|
526
|
+
// get annotated elements into shape info
|
527
|
+
var shapeBBox = objToAttach.getBoundingClientRect();
|
528
|
+
var shapeX = shapeBBox.x;
|
529
|
+
var shapeY = shapeBBox.y;
|
530
|
+
this.m2s.getNoteBBoxes().forEach(bb => {
|
531
|
+
if (bb.x >= shapeX &&
|
532
|
+
bb.x <= shapeX + shapeBBox.width &&
|
533
|
+
bb.y >= shapeY &&
|
534
|
+
bb.y <= shapeY + shapeBBox.height) {
|
535
|
+
newAnnot.targetID.push(bb.id);
|
536
|
+
}
|
537
|
+
});
|
538
|
+
this.annotations.push(newAnnot);
|
539
|
+
}
|
540
|
+
}
|
541
|
+
/**
|
542
|
+
* Delete attributes from Elements which are just used temporarily to resize or drag objects
|
543
|
+
*/
|
544
|
+
deleteTempDistances() {
|
545
|
+
var _a;
|
546
|
+
(_a = cq.getInteractOverlay(this.containerId)) === null || _a === void 0 ? void 0 : _a.querySelector("#annotationCanvas").querySelectorAll("*[distX], *[distY]").forEach(d => {
|
547
|
+
d.removeAttribute("distX");
|
548
|
+
d.removeAttribute("distY");
|
549
|
+
});
|
550
|
+
}
|
551
|
+
/**
|
552
|
+
* Snap Annotation Pointer to highlighted Object
|
553
|
+
*/
|
554
|
+
snapToObj() {
|
555
|
+
this.dragedRect.setAttribute("x", this.snapCoords.x.toString());
|
556
|
+
this.dragedRect.setAttribute("y", this.snapCoords.y.toString());
|
557
|
+
var line = this.dragedRect.closest("g").querySelector(".annotLine");
|
558
|
+
line.setAttribute("x1", this.snapCoords.x.toString());
|
559
|
+
line.setAttribute("y1", this.snapCoords.y.toString());
|
560
|
+
var xDiff = parseFloat(line.getAttribute("x2")) - this.snapCoords.x;
|
561
|
+
var yDiff = parseFloat(line.getAttribute("y2")) - this.snapCoords.y;
|
562
|
+
line.setAttribute("x-diff", xDiff.toString());
|
563
|
+
line.setAttribute("y-diff", yDiff.toString());
|
564
|
+
// clean up after snap
|
565
|
+
this.interactionOverlay.querySelector("#annotationCanvas").querySelectorAll("g").forEach(el => {
|
566
|
+
var shapeChild = el.querySelector(".customAnnotShape");
|
567
|
+
var highlightChild = el.querySelector(".highlightAnnotation");
|
568
|
+
if (shapeChild !== null && el.childElementCount === 1) {
|
569
|
+
el.parentElement.appendChild(shapeChild);
|
570
|
+
document.getElementById(el.id).remove();
|
571
|
+
}
|
572
|
+
if (shapeChild !== null && highlightChild !== null) {
|
573
|
+
el.parentElement.appendChild(shapeChild);
|
574
|
+
}
|
575
|
+
});
|
576
|
+
}
|
577
|
+
update() {
|
578
|
+
this.setContainerId(this.containerId);
|
579
|
+
//this.updateCallback()
|
580
|
+
this.rootBBox = this.interactionOverlay.getBoundingClientRect();
|
581
|
+
this.rootMatrix = this.interactionOverlay.getScreenCTM().inverse();
|
582
|
+
this.customShapes = Array.from(this.interactionOverlay.querySelectorAll(".customAnnotShape"));
|
583
|
+
//this.resetListeners()
|
584
|
+
return this;
|
585
|
+
}
|
586
|
+
setUpdateCallback(updateCallback) {
|
587
|
+
this.updateCallback = updateCallback;
|
588
|
+
return this;
|
589
|
+
}
|
590
|
+
setAnnotations(annotations) {
|
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
|
+
// })
|
604
|
+
// var newFactor = parseInt((cq.getContainer(this.containerId).querySelector("#svgContainer") as HTMLElement).style?.width?.split("%")[0]) || 100
|
605
|
+
// if (newFactor === this.factor) return this
|
606
|
+
// var that = this
|
607
|
+
// function setXYWH(element) {
|
608
|
+
// var x = parseFloat(element.getAttribute("x")) / that.factor * newFactor
|
609
|
+
// var y = parseFloat(element.getAttribute("y")) / that.factor * newFactor
|
610
|
+
// var w = parseFloat(element.getAttribute("width")) / that.factor * newFactor
|
611
|
+
// var h = parseFloat(element.getAttribute("height")) / that.factor * newFactor
|
612
|
+
// element.setAttribute("x", x.toString())
|
613
|
+
// element.setAttribute("y", y.toString())
|
614
|
+
// element.setAttribute("width", w.toString())
|
615
|
+
// element.setAttribute("height", h.toString())
|
616
|
+
// }
|
617
|
+
// function setLineCoords(line) {
|
618
|
+
// var x1 = parseFloat(line.getAttribute("x1")) / that.factor * newFactor
|
619
|
+
// var y1 = parseFloat(line.getAttribute("y1")) / that.factor * newFactor
|
620
|
+
// var x2 = parseFloat(line.getAttribute("x2")) / that.factor * newFactor
|
621
|
+
// var y2 = parseFloat(line.getAttribute("y2")) / that.factor * newFactor
|
622
|
+
// line.setAttribute("x1", x1.toString())
|
623
|
+
// line.setAttribute("y1", y1.toString())
|
624
|
+
// line.setAttribute("x2", x2.toString())
|
625
|
+
// line.setAttribute("y2", y2.toString())
|
626
|
+
// }
|
627
|
+
// this.annotationCanvas.querySelectorAll(":scope > *").forEach(a => {
|
628
|
+
// if (a.tagName === "rect") {
|
629
|
+
// setXYWH(a)
|
630
|
+
// } else {
|
631
|
+
// a.querySelectorAll("[x][y][width][height]").forEach(e => setXYWH(e))
|
632
|
+
// a.querySelectorAll("line").forEach(l => setLineCoords(l))
|
633
|
+
// }
|
634
|
+
// })
|
635
|
+
// that.factor = parseInt((cq.getContainer(this.containerId).querySelector("#svgContainer") as HTMLElement).style?.width?.split("%")[0])
|
636
|
+
return this;
|
637
|
+
}
|
638
|
+
setm2s(m2s) {
|
639
|
+
this.m2s = m2s;
|
640
|
+
return this;
|
641
|
+
}
|
642
|
+
setContainerId(id) {
|
643
|
+
this.containerId = id;
|
644
|
+
this.container = document.getElementById(id);
|
645
|
+
this.interactionOverlay = cq.getInteractOverlay(id);
|
646
|
+
this.annotationCanvas = this.interactionOverlay.querySelector("#annotationCanvas");
|
647
|
+
return this;
|
648
|
+
}
|
649
|
+
}
|
650
|
+
exports.default = AnnotationChangeHandler;
|