Created
June 6, 2014 09:42
-
-
Save leomrocha/2abe02c8f20edc686dcc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mainApp.directive('vextab', function($compile){ | |
//console.log("rendering vextab"); | |
var canvas = document.createElement('canvas'); | |
renderer = new Vex.Flow.Renderer( canvas, | |
//Vex.Flow.Renderer.Backends.SVG); | |
Vex.Flow.Renderer.Backends.CANVAS); | |
artist = new Vex.Flow.Artist(10, 10, 800, {scale: 0.8}); | |
vextab = new Vex.Flow.VexTab(artist); | |
return{ | |
restrict: 'E', | |
link: function(scope, element, attrs){ | |
try { | |
vextab.reset(); | |
artist.reset(); | |
vextab.parse(element.text()); | |
artist.render(renderer); | |
} | |
catch (e) { | |
console.log("Error"); | |
console.log(e); | |
} | |
//element.appendChild(canvas); | |
$compile(canvas)(scope); | |
//element.append(canvas); | |
element.replaceWith(canvas); | |
//console.log("vextab processing"); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, felipediasssss. Did you fix that bug?