Skip to content

Commit

Permalink
Ensure listers are only on use elements in #svg_group
Browse files Browse the repository at this point in the history
Previously this included the `use` elements used for the dropdown
arrows, leading to some errors. Using the selector "#svg_group use" only
gets use elements within the svg_group ID.
Also fix some miscellaneous issues that were giving warnings, but not
impeding functionality.

Resolve #318.
  • Loading branch information
JRegimbal committed Nov 19, 2018
1 parent 060a4b9 commit 9ba5fbd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/Controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ function bindElements(insertHandler) {
*/
function activate(id, insertHandler) {
$("#" + id).addClass("is-active");
insertHandler.insertActive(id);
if (document.getElementById(id).classList.contains("insertel")) {
insertHandler.insertActive(id);
}
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/InsertHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,9 @@ function InsertHandler (neonView) {
editModeButton.innerHTML = "Return to Edit Mode";
editModeContainer.appendChild(editModeButton);
document.getElementById("delete").parentNode.parentNode.appendChild(editModeContainer);
editModeButton.addEventListener("click", insertDisabled);
}

editModeButton.addEventListener("click", insertDisabled);

Notification.queueNotification("Insert Mode");
}

Expand Down
6 changes: 3 additions & 3 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function ClickSelect (dragHandler, zoomHandler, neonView, neon, infoBox)

//Selection mode toggle
function selectListeners () {
var classesToSelect = "use, #svg_group";
var classesToSelect = "#svg_group use, #svg_group";
Controls.initSelectionButtons();

//Activating selected neumes
Expand Down Expand Up @@ -217,9 +217,9 @@ export function DragSelect (dragHandler, zoomHandler, neonView, neon, infoBox) {

var nc;
if ($("#selByStaff").hasClass("is-active")) {
nc = d3.selectAll("use, .staff")._groups[0];
nc = d3.selectAll("#svg_group use, .staff")._groups[0];
} else {
nc = d3.selectAll("use")._groups[0];
nc = d3.selectAll("#svg_group use")._groups[0];
}
var els = Array.from(nc);

Expand Down

0 comments on commit 9ba5fbd

Please sign in to comment.