-
Notifications
You must be signed in to change notification settings - Fork 220
Closed
Labels
area-renderingEverything related to the renderingEverything related to the renderingplatform-javascriptRelated to the JavaScript version of alphaTabRelated to the JavaScript version of alphaTabstate-needs-discussion 💬
Milestone
Description
Your Environment
- Version used: dev branch
- Platform used: JavaScript
- Rendering engine used: SVG
- Browser Name and Version: Chrome 79.0.3945.79
- Operating System and version (desktop or mobile): desktop mac os Mojave
Expected Results
Entire SVG loaded in .alphaTabSurface when alphatab.postRendered callback triggered
Observed Results
at.on("alphaTab.postRendered", function() {
// jQuery selectors accessing SVG render of digital score fail to access entire score
// Only grabs SVG elements for a subset of the systems (lines) because not all have loaded yet
});
currently, I'm have this workaround, although I hate timing-based solutions like this because they invoke race conditions and are fragile:
at.on("alphaTab.postRendered", function() {
$('.alphaTabSurface').css("height", "100%");
setTimeout(function() {
// jQuery selectors here: e.g.,
$("#alphaTab > .alphaTabSurface > svg.alphaTabSurfaceSvg > g[class^='b']")
}, 50);
});
Basically waiting 50ms for the SVG to fully load. This probably has to do with web workers being enabled and loading the score asynchronously? In any case, I think the trigger alphaTab.postRendered should be called when all the systems are loaded and rendered in the DOM.
Steps to Reproduce (for bugs)
Print jQuery selector results to console in the postRendered callback
Metadata
Metadata
Assignees
Labels
area-renderingEverything related to the renderingEverything related to the renderingplatform-javascriptRelated to the JavaScript version of alphaTabRelated to the JavaScript version of alphaTabstate-needs-discussion 💬