Commit bf323460 authored by marc's avatar marc
Browse files

model.js : exportSVG() function

parent 20530c29
......@@ -1912,6 +1912,43 @@ Model.prototype = {
saveAs(textFileAsBlob, filename + ".csv");
},
/**
* save a svg file of the selected svg element.
* @return {file} svg
* */
exportSVG: function (elementID) {
var self = this;
var element = document.getElementById(elementID);
var myWindow = window.open("", "svg");
$(document).ready(function() {
$.when($.get("css/svg.css"))
.done(function(css) {
var textToWrite = '<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">';
textToWrite += "<style>";
css = css.replace(/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g, '');
textToWrite += css;
textToWrite += "</style>";
textToWrite += element.innerHTML;
textToWrite += "</svg>";
myWindow.document.write(textToWrite);
var textFileAsBlob = new Blob([textToWrite], {
type: 'text'
});
var filename = self.getPrintableAnalysisName().replace(/[ \/\\:]/,'_')
//saveAs(textFileAsBlob, filename + ".svg");
self.resize();
});
})
},
/**
* save a csv file of the currently visibles clones.
* @return {string} csv
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment