@@ -42,45 +42,51 @@ <h1 class="page-title">Source: InfoModule.js</h1>
4242 this.neonView = neonView;
4343 // Add info box enable/disable check box
4444 let block = document.getElementById('extensible-block');
45- block.innerHTML = '<label class="checkbox"> Display Info:&nbsp;' +
46- '<input class="checkbox" id="displayInfo" type="checkbox" checked="checked"/> </label> ' +
47- block.innerHTML;
48-
49- InfoModule.neonView = this.neonView;
50- this.neonView.view.addUpdateCallback(InfoModule.resetInfoListeners);
45+ let label = document.createElement('label');
46+ label.classList.add('checkbox');
47+ label.textContent = 'Display Info: ';
48+ let input = document.createElement('input');
49+ input.classList.add('checkbox');
50+ input.id = 'displayInfo';
51+ input.type = 'checkbox';
52+ input.checked = true;
53+ label.appendChild(input);
54+ block.prepend(label);
55+
56+ this.neonView.view.addUpdateCallback(this.resetInfoListeners.bind(this));
5157 setInfoControls();
5258 }
5359
5460 /**
5561 * Set listeners for the InfoModule.
5662 */
57- static infoListeners () {
58- $('.active-page').find('.neume,.custos,.clef').on('mouseover', InfoModule .updateInfo);
63+ infoListeners () {
64+ $('.active-page').find('.neume,.custos,.clef').on('mouseover', this .updateInfo.bind(this) );
5965 }
6066
6167 /**
6268 * Stop listeners for the InfoModule.
6369 */
64- static stopListeners () {
65- $('.neume,.custos,.clef').off('mouseover', InfoModule .updateInfo);
70+ stopListeners () {
71+ $('.neume,.custos,.clef').off('mouseover', this .updateInfo.bind(this) );
6672 }
6773
6874 /**
6975 * Restart listeners for the InfoModule.
7076 */
71- static resetInfoListeners () {
72- InfoModule .stopListeners();
73- InfoModule .infoListeners();
77+ resetInfoListeners () {
78+ this .stopListeners();
79+ this .infoListeners();
7480 }
7581
7682 /**
7783 * Get updated info for the calling element based on its element type.
7884 * Makes calls to NeonCore to get the information necessary.
7985 */
80- static async updateInfo () {
86+ async updateInfo (event ) {
8187 // For now, since Clefs do not have their own element tag in mei4, there is not a way to select the <g> element
8288 // So we will simply return if ID does not exist for now
83- let id = this .id;
89+ let id = event.currentTarget .id;
8490 if (id === '') {
8591 $('#neume_info').empty();
8692 console.log('No id!');
@@ -98,49 +104,49 @@ <h1 class="page-title">Source: InfoModule.js</h1>
98104 case 'neume':
99105 // Select neume components of selected neume
100106 var ncs = element.children('.nc');
101- var contour = await InfoModule .getContour(ncs);
107+ var contour = await this .getContour(ncs);
102108 if (contour === 'Clivis') {
103- var attr = await InfoModule .neonView.getElementAttr($(ncs[0])[0].id, 0 );
109+ var attr = await this .neonView.getElementAttr($(ncs[0])[0].id, this.neonView.view.getCurrentPage() );
104110 if (attr.ligated) {
105111 contour = 'Ligature';
106112 }
107113 }
108- var pitches = await InfoModule .getPitches(ncs);
114+ var pitches = await this .getPitches(ncs);
109115
110116 pitches = pitches.trim().toUpperCase();
111117 body = 'Shape: ' + (contour === undefined ? 'Compound' : contour) + '<br/> ' +
112118 'Pitch(es): ' + pitches;
113119 break;
114120 case 'custos':
115- attributes = await InfoModule .neonView.getElementAttr(id, 0 );
121+ attributes = await this .neonView.getElementAttr(id, this.neonView.view.getCurrentPage() );
116122 body += 'Pitch: ' + (attributes.pname).toUpperCase() + attributes.oct;
117123 break;
118124 case 'clef':
119- attributes = await InfoModule .neonView.getElementAttr(id, 0 );
125+ attributes = await this .neonView.getElementAttr(id, this.neonView.view.getCurrentPage() );
120126 body += 'Shape: ' + attributes.shape + '<br/> ' +
121127 'Line: ' + attributes.line;
122128 break;
123129 case 'staff':
124130 elementClass = 'clef';
125- var staffDefAttributes = await InfoModule .neonView.getElementStaffDef(id);
131+ var staffDefAttributes = await this .neonView.getElementStaffDef(id);
126132 body = 'Shape: ' + staffDefAttributes['clef.shape'] + '<br/> ' +
127133 'Line: ' + staffDefAttributes['clef.line'];
128134 break;
129135 default:
130136 body += 'nothing';
131137 break;
132138 }
133- InfoModule .updateInfoModule(elementClass, body);
139+ this .updateInfoModule(elementClass, body);
134140 }
135141
136142 /**
137143 * Get the individual pitches of a neume.
138144 * @param {array.<SVGGraphicsElement> } ncs - neume components in the neume.
139145 */
140- static async getPitches (ncs) {
146+ async getPitches (ncs) {
141147 var pitches = '';
142148 for (let nc of ncs) {
143- var attributes = await InfoModule .neonView.getElementAttr(nc.id, 0 );
149+ var attributes = await this .neonView.getElementAttr(nc.id, this.neonView.view.getCurrentPage() );
144150 pitches += attributes.pname + attributes.oct + ' ';
145151 }
146152 return pitches;
@@ -150,20 +156,20 @@ <h1 class="page-title">Source: InfoModule.js</h1>
150156 * Get the contour of a neume.
151157 * @param {array.<SVGGraphicsElement> } ncs - neume components in the neume.
152158 */
153- static async getContour (ncs) {
159+ async getContour (ncs) {
154160 var contour = '';
155161 var previous = null;
156162 for (let nc of ncs) {
157- var attributes = await InfoModule .neonView.getElementAttr(nc.id, 0 );
163+ var attributes = await this .neonView.getElementAttr(nc.id, this.neonView.view.getCurrentPage() );
158164 if (previous !== null) {
159165 if (previous.oct > attributes.oct) {
160166 contour += 'd';
161167 } else if (previous.oct < attributes.oct) {
162168 contour += 'u';
163169 } else {
164- if (InfoModule .pitchNameToNum(previous.pname) < InfoModule .pitchNameToNum(attributes.pname)) {
170+ if (this .pitchNameToNum(previous.pname) < this .pitchNameToNum(attributes.pname)) {
165171 contour += 'u';
166- } else if (InfoModule .pitchNameToNum(previous.pname) > InfoModule .pitchNameToNum(attributes.pname)) {
172+ } else if (this .pitchNameToNum(previous.pname) > this .pitchNameToNum(attributes.pname)) {
167173 contour += 'd';
168174 } else {
169175 contour += 's';
@@ -183,7 +189,7 @@ <h1 class="page-title">Source: InfoModule.js</h1>
183189 * @param {string} title - The info box title.
184190 * @param {string} body - The info box contents.
185191 */
186- static updateInfoModule (title, body) {
192+ updateInfoModule (title, body) {
187193 if ($('#displayInfo').is(':checked')) {
188194 $('.message').css('display', '');
189195 $('.message-header').children('p').html(title);
@@ -200,7 +206,7 @@ <h1 class="page-title">Source: InfoModule.js</h1>
200206 * @param {string} pname - The pitch name.
201207 * @returns {number}
202208 */
203- static pitchNameToNum (pname) {
209+ pitchNameToNum (pname) {
204210 switch (pname) {
205211 case 'c':
206212 return 1;
@@ -226,7 +232,7 @@ <h1 class="page-title">Source: InfoModule.js</h1>
226232 * @param {string} value - the value name.
227233 * @returns {string}
228234 */
229- static getContourByValue (value) {
235+ getContourByValue (value) {
230236 for (let [cont, v] of InfoModule.neumeGroups.entries()) {
231237 if (v === value) {
232238 return cont;
@@ -276,13 +282,13 @@ <h1 class="page-title">Source: InfoModule.js</h1>
276282</ div >
277283
278284< nav >
279- < h2 > < a href ="index.html "> Home</ a > </ h2 > < h3 > Modules</ h3 > < ul > < li > < a href ="module-InfoModule.html "> InfoModule</ a > </ li > < li > < a href ="module-Notification.html "> Notification</ a > </ li > < li > < a href ="module-SingleEdit_Contents.html "> SingleEdit/Contents</ a > </ li > < li > < a href ="module-SingleEdit_EditControls.html "> SingleEdit/EditControls</ a > </ li > < li > < a href ="module-SingleEdit_Grouping.html "> SingleEdit/Grouping</ a > </ li > < li > < a href ="module-SingleEdit_ResizeStaff.html "> SingleEdit/ResizeStaff</ a > </ li > < li > < a href ="module-SingleEdit_Select.html "> SingleEdit/Select</ a > </ li > < li > < a href ="module-SingleEdit_SelectOptions.html "> SingleEdit/SelectOptions</ a > </ li > < li > < a href ="module-SingleView_DisplayControls.html "> SingleView/DisplayControls</ a > </ li > < li > < a href ="module-SingleView_DisplayPanel.html "> SingleView/DisplayPanel</ a > </ li > < li > < a href ="module-SingleView_Zoom.html "> SingleView/Zoom</ a > </ li > < li > < a href ="module-utils_Color.html "> utils/Color</ a > </ li > < li > < a href ="module-utils_Cursor.html "> utils/Cursor</ a > </ li > < li > < a href ="module-Validation.html "> Validation</ a > </ li > < li > < a href ="module-Warnings.html "> Warnings</ a > </ li > </ ul > < h3 > Classes</ h3 > < ul > < li > < a href ="DragHandler.html "> DragHandler</ a > </ li > < li > < a href ="InsertHandler.html "> InsertHandler</ a > </ li > < li > < a href ="module-InfoModule-InfoModule.html "> InfoModule</ a > </ li > < li > < a href ="module-Notification-Notification.html "> Notification</ a > </ li > < li > < a href ="module-SingleEdit_ResizeStaff-Resize.html "> Resize</ a > </ li > < li > < a href ="module-SingleView_DisplayPanel-DisplayPanel.html "> DisplayPanel</ a > </ li > < li > < a href ="module-SingleView_Zoom.ViewBox.html "> ViewBox</ a > </ li > < li > < a href ="module-SingleView_Zoom-ZoomHandler.html "> ZoomHandler</ a > </ li > < li > < a href ="NeonCore.html "> NeonCore</ a > </ li > < li > < a href ="NeonView.html "> NeonView</ a > </ li > < li > < a href ="SingleEditMode.html "> SingleEditMode</ a > </ li > < li > < a href ="SingleView.html "> SingleView</ a > </ li > < li > < a href ="SplitHandler.html "> SplitHandler</ a > </ li > </ ul > < h3 > < a href ="global.html "> Global</ a > </ h3 >
285+ < h2 > < a href ="index.html "> Home</ a > </ h2 > < h3 > Modules</ h3 > < ul > < li > < a href ="module-InfoModule.html "> InfoModule</ a > </ li > < li > < a href ="module-Notification.html "> Notification</ a > </ li > < li > < a href ="module-SingleEdit_Contents.html "> SingleEdit/Contents</ a > </ li > < li > < a href ="module-SingleEdit_EditControls.html "> SingleEdit/EditControls</ a > </ li > < li > < a href ="module-SingleEdit_Grouping.html "> SingleEdit/Grouping</ a > </ li > < li > < a href ="module-SingleEdit_ResizeStaff.html "> SingleEdit/ResizeStaff</ a > </ li > < li > < a href ="module-SingleEdit_Select.html "> SingleEdit/Select</ a > </ li > < li > < a href ="module-SingleEdit_SelectOptions.html "> SingleEdit/SelectOptions</ a > </ li > < li > < a href ="module-SingleView_Zoom.html "> SingleView/Zoom</ a > </ li > < li > < a href ="module-TextView.html "> TextView</ a > </ li > < li > < a href ="module-utils_Color.html "> utils/Color</ a > </ li > < li > < a href ="module-utils_Cursor.html "> utils/Cursor</ a > </ li > < li > < a href ="module-Validation.html "> Validation</ a > </ li > < li > < a href ="module-Warnings.html "> Warnings</ a > </ li > </ ul > < h3 > Classes</ h3 > < ul > < li > < a href ="DragHandler.html "> DragHandler</ a > </ li > < li > < a href ="InsertHandler.html "> InsertHandler</ a > </ li > < li > < a href ="module-InfoModule-InfoModule.html "> InfoModule</ a > </ li > < li > < a href ="module-Notification-Notification.html "> Notification</ a > </ li > < li > < a href ="module-SingleEdit_ResizeStaff-Resize.html "> Resize</ a > </ li > < li > < a href ="module-SingleView_Zoom.ViewBox.html "> ViewBox</ a > </ li > < li > < a href ="module-SingleView_Zoom-ZoomHandler.html "> ZoomHandler</ a > </ li > < li > < a href ="module-TextView-TextView.html "> TextView</ a > </ li > < li > < a href ="NeonCore.html "> NeonCore</ a > </ li > < li > < a href ="NeonView.html "> NeonView</ a > </ li > < li > < a href ="SingleEditMode.html "> SingleEditMode</ a > </ li > < li > < a href ="SingleView.html "> SingleView</ a > </ li > < li > < a href ="SplitHandler.html "> SplitHandler</ a > </ li > </ ul > < h3 > < a href ="global.html "> Global</ a > </ h3 >
280286</ nav >
281287
282288< br class ="clear ">
283289
284290< footer >
285- Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 3.6.1 </ a > on Tue May 14 2019 10:56:12 GMT-0400 (GMT-04:00)
291+ Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 3.6.2 </ a > on Tue Jun 18 2019 11:17:42 GMT-0400 (GMT-04:00)
286292</ footer >
287293
288294< script > prettyPrint ( ) ; </ script >
0 commit comments