Commit 54fd4251 authored by amandaghassaei's avatar amandaghassaei

save svg

parent cd41ba82
......@@ -112,6 +112,10 @@ function initControls(globals){
globals.threeView.saveSVG();
});
setLink("#saveSVG", function(){
globals.pattern.saveSVG();
});
setCheckbox("#ambientOcclusion", globals.ambientOcclusion, function(val){
globals.ambientOcclusion = val;
});
......
......@@ -638,8 +638,27 @@ function initPattern(globals){
};
}
function saveSVG(){
if (globals.extension == "fold"){
//todo solve for crease pattern
globals.warn("No crease pattern available for FOLD format.");
return;
}
var serializer = new XMLSerializer();
var source = serializer.serializeToString(document.getElementById("mySVG"));
var svgBlob = new Blob([source], {type:"image/svg+xml;charset=utf-8"});
var svgUrl = URL.createObjectURL(svgBlob);
var downloadLink = document.createElement("a");
downloadLink.href = svgUrl;
downloadLink.download = globals.filename + ".svg";
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
}
return {
loadSVG: loadSVG,
saveSVG: saveSVG,
getFacesAndVerticesForEdges: getFacesAndVerticesForEdges,
triangulatePolys: triangulatePolys
}
......
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