We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add svgBoundingBoxes: "true" as a verovio option (or --svg-bounding-boxes on the command line). This make clicking on notes easier:
svgBoundingBoxes: "true"
--svg-bounding-boxes
The blue box is the new clickable region (previously only the black pixels of the note were clickable.
For slurs, the bounding box element is before in the clicking hierarchy than the slur, but probably not a problem:
(using the example HTML code below, which will list the element ancestors of the SVG image that are <g> elements when clicking on the page.
<g>
This CSS allows the white holes in half and whole noteheads to be clickable in Chrome:
g[id^="note-"], g[id^="rest-"], g[id^="chord-"] { pointer-events: bounding-box; }
Keeping this, but probably not necessary anymore.
Test example:
<html> <head> <title>My Score</title> <script src="https://plugin.humdrum.org/scripts/humdrum-notation-plugin-worker.js"></script> </head> <body> <script> displayHumdrum({ source: "my-score", autoResize: "true", pageWidth: 1500, header: "true", svgBoundingBoxes: "true" }); </script> <script type="text/x-humdrum" id="my-score"> !!!OTL: Twinkle, Twinkle, Little Star !!!header-right: W.A. Mozart **kern **harm *clefG2 * *M4/4 * =1 =1 4c I (4c . 4g) V 4g 4b . =2 =2 4a vi 4a . 2g V =3 =3 4f IV 4f . 4e Ib 4e . =4 =4 4d Vc 4d . 2c I == == *- *- </script> <div id="click-elements"></div> <script> document.addEventListener("click", function (event) { let target = event.target; let gelements = []; while (target) { if (target.nodeName === "svg") { break; } if (target.nodeName === "g") { gelements.push(target); } target = target.parentNode; } let infoElement = document.querySelector("#click-elements"); if (gelements.length === 0) { infoElement.innerHTML = ""; return; } let output = "<table>"; output += "<tr><th>Element</th><th>ID</th><th>Class(es)</th></tr>"; for (let i = 0; i < gelements.length; i++) { output += "<tr>"; output += `<td>${gelements[i].nodeName}</td>`; output += `<td>${gelements[i].id}</td>`; output += `<td>${gelements[i].getAttribute('class')}</td>`; output += "</tr>"; } output += "</table>"; infoElement.innerHTML = output; }); </script> <style> svg tspan { cursor: default; } th, td { text-align: left; } g[id^="rest-"], g[id^="note-"], g[id^="chord-"] { pointer-events: bounding-box; } g[id^="harm-"]:hover, g[id^="note-"]:hover, g[id^="rest-"]:hover, g[id^="tie-"]:hover, g[id^="fermata-"]:hover, g[id^="slur-"]:hover { fill: orange; } </style> </body> </html>
Remove svgBoundingBoxes: "true" to compare.
The text was updated successfully, but these errors were encountered:
craigsapp
No branches or pull requests
Add
svgBoundingBoxes: "true"
as a verovio option (or--svg-bounding-boxes
on the command line). This make clicking on notes easier:The blue box is the new clickable region (previously only the black pixels of the note were clickable.
For slurs, the bounding box element is before in the clicking hierarchy than the slur, but probably not a problem:
(using the example HTML code below, which will list the element ancestors of the SVG image that are
<g>
elements when clicking on the page.This CSS allows the white holes in half and whole noteheads to be clickable in Chrome:
Keeping this, but probably not necessary anymore.
Test example:
Remove
svgBoundingBoxes: "true"
to compare.The text was updated successfully, but these errors were encountered: