Skip to content

Commit

Permalink
redraw svg when we update code or resize window
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Florit committed Mar 17, 2012
1 parent d834ae0 commit cc458f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions js/water.js
Expand Up @@ -9,9 +9,7 @@ window.aceEditor.setTheme("ace/theme/twilight");
var JavaScriptMode = require("ace/mode/javascript").Mode;
window.aceEditor.getSession().setMode(new JavaScriptMode());

// redraw svg when we update our code
window.aceEditor.getSession().on('change', function() {

function redrawSvg() {
// clear the window
$('svg').empty();

Expand All @@ -27,7 +25,11 @@ window.aceEditor.getSession().on('change', function() {
}
catch (error) {}
finally {};
});
}

// redraw svg when we update our code or resize the window
window.aceEditor.getSession().on('change', redrawSvg);
$(window).on('resize', redrawSvg);

d3.text('http://gabrielflor.it/static/submodule/water/data/chord.txt', function(data) {

Expand Down

0 comments on commit cc458f8

Please sign in to comment.